diff --git a/Character/DropHats/DropHat.model.json b/Character/DropHats/DropHat.model.json index 01c01cc..3974564 100644 --- a/Character/DropHats/DropHat.model.json +++ b/Character/DropHats/DropHat.model.json @@ -1,3 +1 @@ -{ - "ClassName": "RemoteEvent" -} \ No newline at end of file +{ "ClassName": "RemoteEvent" } \ No newline at end of file diff --git a/Character/Sound.server.lua b/Character/Sound.server.lua deleted file mode 100644 index e6ebcdb..0000000 --- a/Character/Sound.server.lua +++ /dev/null @@ -1,68 +0,0 @@ --- util - -function waitForChild(parent, childName) - local child = parent:findFirstChild(childName) - if child then return child end - while true do - child = parent.ChildAdded:wait() - if child.Name==childName then return child end - end -end - -function newSound(id) - local sound = Instance.new("Sound") - sound.SoundId = id - sound.archivable = false - sound.Parent = script.Parent.Head - return sound -end - --- declarations - -local sDied = newSound("rbxasset://sounds/uuhhh.wav") -local sFallingDown = newSound("rbxasset://sounds/splat.wav") -local sFreeFalling = newSound("rbxasset://sounds/swoosh.wav") -local sGettingUp = newSound("rbxasset://sounds/hit.wav") -local sJumping = newSound("rbxasset://sounds/button.wav") -local sRunning = newSound("rbxasset://sounds/bfsl-minifigfoots1.mp3") -sRunning.Looped = true - -local Figure = script.Parent -local Head = waitForChild(Figure, "Head") -local Humanoid = waitForChild(Figure, "Humanoid") ---local Climbing = Figure:WaitForChild("Climbing") - --- functions - -function onDied() - sDied:Play() -end - -function onJumping() - sJumping:Play() - wait(0.2) - sJumping:Stop() -end - -function onState(state, sound) - sound.TimePosition = 0 - sound.Playing = state -end - -function onRunning(speed) - sRunning.Playing = (speed>0.1) -end - --- connect up - -Humanoid.Died:connect(onDied) -Humanoid.Running:connect(onRunning) -Humanoid.Jumping:connect(onJumping) -Humanoid.GettingUp:connect(function(state) onState(state, sGettingUp) end) -Humanoid.FreeFalling:connect(function(state) - --if not Climbing.Value then - onState(state, sFreeFalling) - --end -end) - -Humanoid.FallingDown:connect(function(state) onState(state, sFallingDown) end) diff --git a/Client/Animator.client.lua b/Client/Animator.client.lua index 661e3a6..b8a553e 100644 --- a/Client/Animator.client.lua +++ b/Client/Animator.client.lua @@ -12,9 +12,14 @@ local RunService = game:GetService("RunService") local Animators = {} local function createAnimator(humanoid) - local Figure = humanoid.Parent - local Torso = Figure:WaitForChild("Torso") - local Climbing = Figure:WaitForChild("Climbing") + local Figure = humanoid.Parent + + local Torso = Figure:WaitForChild("Torso", 5) + local Climbing = Figure:WaitForChild("Climbing", 5) + + if not (Torso and Climbing) then + return + end local animator = {} animator.Joints = {} @@ -183,17 +188,13 @@ local function createAnimator(humanoid) return animator end -local function onAnimatorAdded(humanoid) - if humanoid:IsA("Humanoid") then +local function createAnimatorAsync(humanoid, callback) + local async = coroutine.wrap(function () local animator = createAnimator(humanoid) - Animators[humanoid] = animator - end -end - -local function onAnimatorRemoved(humanoid) - if Animators[humanoid] then - Animators[humanoid] = nil - end + callback(animator) + end) + + async() end ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- @@ -205,10 +206,24 @@ local animTag = "Animator" local animAdded = CollectionService:GetInstanceAddedSignal(animTag) local animRemoved = CollectionService:GetInstanceRemovedSignal(animTag) +local function onAnimatorAdded(humanoid) + if humanoid:IsA("Humanoid") then + createAnimatorAsync(humanoid, function (animator) + if CollectionService:HasTag(humanoid, animTag) then + Animators[humanoid] = animator + end + end) + end +end + +local function onAnimatorRemoved(humanoid) + if Animators[humanoid] then + Animators[humanoid] = nil + end +end + for _,humanoid in pairs(CollectionService:GetTagged(animTag)) do - spawn(function () - onAnimatorAdded(humanoid) - end) + onAnimatorAdded(humanoid) end animAdded:Connect(onAnimatorAdded) @@ -218,11 +233,10 @@ animRemoved:Connect(onAnimatorRemoved) -- Motor Angle Updater ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -local desiredFPS = 1 / 30 -- The framerate that would be expected given the MaxVelocity in use. -local lastUpdate = tick() +local desiredFPS = 30 -- The framerate that would be expected given the MaxVelocity in use. local function updateAnimations(deltaTime) - local velocityAdjust = (1 / desiredFPS) * deltaTime + local velocityAdjust = desiredFPS * deltaTime for humanoid, animator in pairs(Animators) do -- Update the motor states diff --git a/Client/Explosions/ClassicExp.rbxmx b/Client/Explosions/Particle.rbxmx similarity index 100% rename from Client/Explosions/ClassicExp.rbxmx rename to Client/Explosions/Particle.rbxmx diff --git a/Client/Explosions/init.client.lua b/Client/Explosions/init.client.lua index b559745..18e35da 100644 --- a/Client/Explosions/init.client.lua +++ b/Client/Explosions/init.client.lua @@ -1,7 +1,7 @@ local TeleportService = game:GetService("TeleportService") -local classicExp = script:WaitForChild("ClassicExp") -local c = workspace.CurrentCamera +local classicExp = script:WaitForChild("Particle") +local camera = workspace.CurrentCamera local baseExpAdorn = Instance.new("UnionOperation") baseExpAdorn.Name = "ExplosionAdorn" @@ -15,8 +15,10 @@ local function onDescendantAdded(exp) if exp:IsA("Explosion") then local cf = CFrame.new(exp.Position) local expAdorn = baseExpAdorn:Clone() + local lifeTime = 1.5 exp.Visible = false + if TeleportService:GetTeleportSetting("RetroExplosions") then local expObj = Instance.new("SphereHandleAdornment") expObj.Adornee = expAdorn @@ -24,25 +26,31 @@ local function onDescendantAdded(exp) expObj.Color3 = Color3.new(1,0,0) expObj.CFrame = cf expObj.Parent = expAdorn + lifeTime = 1 + if exp.BlastRadius > 1 then lifeTime = lifeTime - (1/exp.BlastRadius) end else + local e = classicExp:Clone() + e.Parent = expAdorn + expAdorn.CFrame = cf + spawn(function () - local e = classicExp:Clone() - e.Parent = expAdorn - expAdorn.CFrame = cf local lessParticles = TeleportService:GetTeleportSetting("ReducedParticles") local count = lessParticles and 25 or 100 - for i = 1,8 do + + for i = 1, 8 do e:Emit(count) wait(0.125) end end) end - expAdorn.Parent = c + + expAdorn.Parent = camera wait(lifeTime) + expAdorn:Destroy() end end diff --git a/Shared/ReplicatedStorage/Client/FpsCap.lua b/Client/FpsCap.client.lua similarity index 100% rename from Shared/ReplicatedStorage/Client/FpsCap.lua rename to Client/FpsCap.client.lua diff --git a/Client/HumanoidSound.client.lua b/Client/HumanoidSound.client.lua new file mode 100644 index 0000000..44d0a78 --- /dev/null +++ b/Client/HumanoidSound.client.lua @@ -0,0 +1,142 @@ +local CollectionService = game:GetService("CollectionService") +local RunService = game:GetService("RunService") +local Debris = game:GetService("Debris") + +local soundTag = "HumanoidSound" +local soundMounted = CollectionService:GetInstanceAddedSignal(soundTag) + +---------------------------------------------------------------------------------------------------- + +local function deleteSound(sound) + sound.EmitterSize = 0 + Debris:AddItem(sound, 0.1) +end + +local function setSoundId(soundId, andThen) + return function (sound, humanoid) + sound.SoundId = "rbxasset://sounds/" .. soundId + sound.Pitch = 1 + + if andThen then + andThen(sound, humanoid) + end + end +end + +local function mountSoundToState(sound) + return function (state) + sound.TimePosition = 0 + sound.Playing = state + end +end + +local function createSound(name, fileName, parent) + local sound = Instance.new("Sound") + sound.SoundId = "rbxasset://sounds/" .. fileName + sound.Parent = parent + sound.Name = name + + return sound +end + +local function promiseChild(object, name, andThen, ...) + local args = {...} + + local callback = coroutine.wrap(function () + local child = object:WaitForChild(name, 10) + + if child then + andThen(child, unpack(args)) + end + end) + + callback() +end + +---------------------------------------------------------------------------------------------------- + +local soundActions = +{ + Splash = deleteSound; + Landing = deleteSound; + Climbing = deleteSound; + Swimming = deleteSound; + FreeFalling = deleteSound; + + GettingUp = setSoundId("hit.wav"); + Running = setSoundId("bfsl-minifigfoots1.mp3"); + + Jumping = setSoundId("button.wav", function (jumping, humanoid) + humanoid.Jumping:Connect(function () + wait(0.1 + (math.random() / 10)) + jumping:Stop() + end) + end); +} + +local function onSoundMounted(humanoid) + if not humanoid:IsA("Humanoid") then + return + end + + local avatar = humanoid.Parent + + promiseChild(avatar, "HumanoidRootPart", function (rootPart) + local fallingDown = createSound("FallingDown", "splat.wav", rootPart) + humanoid.FallingDown:Connect(mountSoundToState(fallingDown)) + + local freeFalling = createSound("FreeFall", "swoosh.wav", rootPart) + humanoid.FreeFalling:Connect(mountSoundToState(freeFalling)) + + for soundName, soundAction in pairs(soundActions) do + promiseChild(rootPart, soundName, soundAction, humanoid) + end + + local mountClimbSound = coroutine.wrap(function () + local running = rootPart:WaitForChild("Running", 10) + local climbing = avatar:WaitForChild("Climbing", 10) + + if not (running and climbing) then + return + end + + local function onClimbing(isClimbing) + if not isClimbing then + return + end + + while climbing.Value do + if not avatar:IsDescendantOf(workspace) then + break + end + + local state = humanoid:GetState() + + if state.Name == "Freefall" then + if running.IsPaused then + running:Resume() + end + + if freeFalling.IsPlaying then + freeFalling:Stop() + end + end + + RunService.Heartbeat:Wait() + end + end + + climbing.Changed:Connect(onClimbing) + end) + + mountClimbSound() + end) +end + +for _,humanoid in pairs(CollectionService:GetTagged(soundTag)) do + onSoundMounted(humanoid) +end + +soundMounted:Connect(onSoundMounted) + +---------------------------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Shared/ReplicatedStorage/Client/LensFlare.lua b/Client/LensFlare.client.lua similarity index 100% rename from Shared/ReplicatedStorage/Client/LensFlare.lua rename to Client/LensFlare.client.lua diff --git a/Shared/ReplicatedStorage/Client/Moon/Moon.rbxmx b/Client/Moon/Moon.rbxmx similarity index 100% rename from Shared/ReplicatedStorage/Client/Moon/Moon.rbxmx rename to Client/Moon/Moon.rbxmx diff --git a/Client/Moon/init.client.lua b/Client/Moon/init.client.lua new file mode 100644 index 0000000..7df7d1f --- /dev/null +++ b/Client/Moon/init.client.lua @@ -0,0 +1,23 @@ +local RunService = game:GetService("RunService") +local Lighting = game:GetService("Lighting") +local TeleportService = game:GetService("TeleportService") + +local camera = workspace.CurrentCamera +local moon = script:WaitForChild("Moon") + +moon.Locked = true +moon.Size = Vector3.new(50, 50, 1) + +local function moonUpdate() + if TeleportService:GetTeleportSetting("ClassicSky") then + local pos = Lighting:GetMoonDirection() * 900 + local origin = camera.CFrame.Position + + moon.Parent = camera + moon.CFrame = CFrame.new(origin + pos, origin) + else + moon.Parent = nil + end +end + +RunService:BindToRenderStep("MoonUpdate", 201, moonUpdate) \ No newline at end of file diff --git a/Client/PassCameraEvent.model.json b/Client/PassCameraEvent.model.json new file mode 100644 index 0000000..12a921b --- /dev/null +++ b/Client/PassCameraEvent.model.json @@ -0,0 +1 @@ +{ "ClassName": "BindableEvent" } \ No newline at end of file diff --git a/Client/Shared.client.lua b/Client/Shared.client.lua deleted file mode 100644 index d359e26..0000000 --- a/Client/Shared.client.lua +++ /dev/null @@ -1,9 +0,0 @@ -local TARGET = script.Name - -do - local ReplicatedStorage = game:GetService("ReplicatedStorage") - local client = ReplicatedStorage:WaitForChild("Client") - local targetScript = client:WaitForChild(TARGET) - local activation = require(targetScript) - activation(script) -end \ No newline at end of file diff --git a/Shared/ReplicatedStorage/Client/Sky/SkyAdorn.rbxmx b/Client/Sky/SkyAdorn.rbxmx similarity index 100% rename from Shared/ReplicatedStorage/Client/Sky/SkyAdorn.rbxmx rename to Client/Sky/SkyAdorn.rbxmx diff --git a/Shared/ReplicatedStorage/Client/Sky/Star.rbxmx b/Client/Sky/Star.rbxmx similarity index 100% rename from Shared/ReplicatedStorage/Client/Sky/Star.rbxmx rename to Client/Sky/Star.rbxmx diff --git a/Client/Sky/init.client.lua b/Client/Sky/init.client.lua new file mode 100644 index 0000000..ac165b2 --- /dev/null +++ b/Client/Sky/init.client.lua @@ -0,0 +1,133 @@ +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +-- Services + +local Lighting = game:GetService("Lighting") +local RunService = game:GetService("RunService") +local TeleportService = game:GetService("TeleportService") +local UserInputService = game:GetService("UserInputService") + +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +-- Sky Colors + +local midnight = 0 +local day = 86400 +local hour = day/24 + +local sunRise = day * .25 +local sunSet = day * .75 +local riseAndSetTime = hour/2 + +local times = +{ + midnight; + sunRise - hour; + sunRise - riseAndSetTime; + sunRise; + sunRise + riseAndSetTime; + sunSet - riseAndSetTime; + sunSet; + sunSet + (hour/3); + day; +} + +local colors = +{ + Color3.new(); + Color3.new(); + Color3.new(.2, .15, .01); + Color3.new(.2, .15, .01); + Color3.new(1, 1, 1); + Color3.new(1, 1, 1); + Color3.new(.4, .2, .05); + Color3.new(); + Color3.new(); +} + +local function linearSpline(x, times, values) + assert(#times == #values) + + if #values == 1 or x < times[1] then + return values[1] + end + + for i = 2, #times do + if x < times[i] then + local alpha = (times[i] - x) / (times[i] - times[i - 1]) + return values[i - 1]:lerp(values[i], 1 - alpha) + end + end + + return values[#values] +end + +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + +local function r() + return -1 + (math.random()*2) +end + +local lastTime = 0 +local camera = workspace.CurrentCamera + +local skyAdorn = script:WaitForChild("SkyAdorn") +local night = skyAdorn:WaitForChild("Night") +local nightFrame = night:WaitForChild("NightFrame") +local star = script:WaitForChild("Star") + +local shadowsOn = true + +for i = 1, 500 do + local bb = star:Clone() + bb.StudsOffsetWorldSpace = Vector3.new(r(), r(), r()).Unit * 2500 + bb.Size = UDim2.new(0, math.random(2, 5), 0, math.random(2, 5)) + bb.Adornee = skyAdorn + bb.Parent = skyAdorn +end + +local function updateSky() + local shadowState = TeleportService:GetTeleportSetting("StencilShadows") + + if shadowState == nil then + TeleportService:SetTeleportSetting("StencilShadows", true) + shadowState = true + end + + if shadowState ~= shadowsOn then + shadowsOn = shadowState + + if shadowsOn then + local black = Color3.new() + Lighting.GlobalShadows = true + Lighting.Ambient = black:Lerp(Lighting.OutdoorAmbient, 0.5) + else + Lighting.GlobalShadows = false + Lighting.Ambient = Lighting.OutdoorAmbient + end + end + + if TeleportService:GetTeleportSetting("ClassicSky") then + local seconds = Lighting:GetMinutesAfterMidnight() * 60 + + if seconds < 0 then + seconds = day + seconds + end + + if seconds ~= lastTime then + local sunDir = game.Lighting:GetSunDirection() + local skyColor = linearSpline(seconds, times, colors) + nightFrame.BackgroundColor3 = skyColor + nightFrame.BackgroundTransparency = math.clamp((sunDir.Y + .033) * 10, 0, 1) + lastTime = seconds + end + + local sunDir = Lighting:GetSunDirection() + skyAdorn.CFrame = CFrame.new(c.CFrame.p) * CFrame.new(Vector3.new(), sunDir) + skyAdorn.Parent = (nightFrame.BackgroundTransparency < 1 and c or nil) + else + skyAdorn.Parent = nil + end +end + +RunService:BindToRenderStep("UpdateSky", 201, updateSky) + +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Shared/ReplicatedStorage/Client/SunRays/Rays.rbxmx b/Client/SunRays/Rays.rbxmx similarity index 100% rename from Shared/ReplicatedStorage/Client/SunRays/Rays.rbxmx rename to Client/SunRays/Rays.rbxmx diff --git a/Shared/ReplicatedStorage/Client/SunRays.lua b/Client/SunRays/init.client.lua similarity index 57% rename from Shared/ReplicatedStorage/Client/SunRays.lua rename to Client/SunRays/init.client.lua index 32e763b..89000df 100644 --- a/Shared/ReplicatedStorage/Client/SunRays.lua +++ b/Client/SunRays/init.client.lua @@ -9,10 +9,10 @@ local function getCamera() return workspace.CurrentCamera end -local function projectRay(ray,length) +local function projectRay(ray, length) local origin = ray.Origin local direction = ray.Direction - return Ray.new(origin,direction.Unit * length) + return Ray.new(origin, direction.Unit * length) end local function computeSunVisibility() @@ -20,29 +20,30 @@ local function computeSunVisibility() local camera = getCamera() local cf = camera.CFrame - if sunPos:Dot(cf.lookVector) > 0 then - local sunView = camera:WorldToViewportPoint(cf.p + sunPos) + if sunPos:Dot(cf.LookVector) > 0 then + local sunView = camera:WorldToViewportPoint(cf.Position + sunPos) local visibility = 0 local total = 0 - for dx = -1,1 do - for dy = -1,1 do + for dx = -1, 1 do + for dy = -1, 1 do local posX = math.floor(sunView.X + dx * 15) local posY = math.floor(sunView.Y + dy * 15) local sunRay = camera:ViewportPointToRay(posX, posY) - sunRay = projectRay(sunRay,5000) + sunRay = projectRay(sunRay, 5000) + + local hit, pos = workspace:FindPartOnRay(sunRay, camera) - local hit,pos = workspace:FindPartOnRay(sunRay,camera) if not hit then visibility = visibility + 1 end + total = total + 1 end end - visibility = visibility / total - return visibility,sunView + return visibility / total, sunView end return 0 @@ -52,19 +53,20 @@ local function update() if TeleportService:GetTeleportSetting("ClassicSky") then local sunPos = Lighting:GetSunDirection() if sunPos.Y >= -.1 then - local visibility,sunView = computeSunVisibility() + local visibility, sunView = computeSunVisibility() + if visibility > 0.001 then - local attenuation = (1 - (2*visibility - 1)*(2*visibility - 1)) - local strength = math.clamp((((1 - sunPos.Y)*2) / math.sqrt(2)), 0, 1) + local attenuation = (1 - (2 * visibility - 1) * (2 * visibility - 1)) + local strength = math.clamp((((1 - sunPos.Y) * 2) / math.sqrt(2)), 0, 1) local opacity = attenuation * 0.4 * strength local camera = getCamera() - local rayPos = camera:ViewportPointToRay(sunView.X,sunView.Y,1).Origin - local rayLook = camera.CFrame.p + local rayPos = camera:ViewportPointToRay(sunView.X, sunView.Y, 1).Origin + local rayLook = camera.CFrame.Position adorn.Parent = camera - adorn.CFrame = CFrame.new(rayPos,rayLook) - sunRays.Transparency = NumberSequence.new(1-opacity) + adorn.CFrame = CFrame.new(rayPos, rayLook) + sunRays.Transparency = NumberSequence.new(1 - opacity) return end @@ -74,6 +76,4 @@ local function update() adorn.Parent = nil end -return function () - RunService:BindToRenderStep("SunRays",201,update) -end \ No newline at end of file +RunService:BindToRenderStep("SunRays", 201, update) \ No newline at end of file diff --git a/Resources/GameJoin/GuiRoot.rbxmx b/Resources/GameJoin/DEPRECATED_GuiRoot.rbxmx similarity index 100% rename from Resources/GameJoin/GuiRoot.rbxmx rename to Resources/GameJoin/DEPRECATED_GuiRoot.rbxmx diff --git a/Resources/GameJoin/init.client.lua b/Resources/GameJoin/init.client.lua index 6069745..51b39c4 100644 --- a/Resources/GameJoin/init.client.lua +++ b/Resources/GameJoin/init.client.lua @@ -1,25 +1,21 @@ local CollectionService = game:GetService("CollectionService") -local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") +local ReplicatedFirst = game:GetService("ReplicatedFirst") local TeleportService = game:GetService("TeleportService") -local ReplicatedFirst = script.Parent local JointsService = game:GetService("JointsService") +local RunService = game:GetService("RunService") +local StarterGui = game:GetService("StarterGui") -do - local StarterGui = game:GetService("StarterGui") - - local function setCoreSafe(method,...) - while not pcall(StarterGui.SetCore, StarterGui, method,...) do +spawn(function () + local function setCoreSafe(method, ...) + while not pcall(StarterGui.SetCore, StarterGui, method, ...) do wait() end end - spawn(function () - setCoreSafe("ResetButtonCallback", false) - end) - setCoreSafe("TopbarEnabled", false) -end + setCoreSafe("ResetButtonCallback", false) +end) local player = game.Players.LocalPlayer local playerGui = player:WaitForChild("PlayerGui") @@ -29,8 +25,13 @@ if not UserInputService.TouchEnabled then mouse.Icon = "rbxassetid://334630296" end -local guiRoot = script:WaitForChild("GuiRoot") -guiRoot.Parent = playerGui +local ui = script:FindFirstChild("UI") + +if ui then + ui.Parent = playerGui +else + ui = playerGui:WaitForChild("UI") +end ReplicatedFirst:RemoveDefaultLoadingScreen() @@ -38,14 +39,12 @@ if playerGui:FindFirstChild("ConnectingGui") then playerGui.ConnectingGui:Destroy() end -if RunService:IsStudio() then +--[[if RunService:IsStudio() then return -end +end]] -local c = workspace.CurrentCamera -local IS_PHONE = c.ViewportSize.Y < 600 - -local topbar = guiRoot:WaitForChild("Topbar") +local IS_PHONE = ui.AbsoluteSize.Y < 600 +local topbar = ui:WaitForChild("Topbar") if IS_PHONE then local uiScale = Instance.new("UIScale") @@ -53,7 +52,7 @@ if IS_PHONE then uiScale.Parent = topbar end -local messageGui = guiRoot:WaitForChild("MessageGui") +local messageGui = ui:WaitForChild("GameJoin") local message = messageGui:WaitForChild("Message") local partWatch = nil @@ -90,9 +89,9 @@ end --------------------------------------------------------------------- -local c = workspace.CurrentCamera -c.CameraType = "Follow" -c.CameraSubject = workspace +local camera = workspace.CurrentCamera +camera.CameraType = "Follow" +camera.CameraSubject = workspace messageGui.Visible = true @@ -140,7 +139,7 @@ if partWatch then partWatch = nil end -c.CameraSubject = nil +camera.CameraSubject = nil message.Text = "Requesting character..." wait(1) @@ -157,4 +156,4 @@ while not player.Character do end messageGui.Visible = false -c.CameraType = "Custom" \ No newline at end of file +camera.CameraType = "Custom" \ No newline at end of file diff --git a/Resources/GameJoin/GuiRoot/Topbar/Buttons.client.lua b/Resources/GuiRoot/Topbar/Buttons.client.lua similarity index 100% rename from Resources/GameJoin/GuiRoot/Topbar/Buttons.client.lua rename to Resources/GuiRoot/Topbar/Buttons.client.lua diff --git a/Resources/GameJoin/GuiRoot/Topbar/Exit/Exit.client.lua b/Resources/GuiRoot/Topbar/Exit/Exit.client.lua similarity index 100% rename from Resources/GameJoin/GuiRoot/Topbar/Exit/Exit.client.lua rename to Resources/GuiRoot/Topbar/Exit/Exit.client.lua diff --git a/Resources/GameJoin/GuiRoot/Topbar/Fullscreen/Fullscreen.client.lua b/Resources/GuiRoot/Topbar/Fullscreen/Fullscreen.client.lua similarity index 100% rename from Resources/GameJoin/GuiRoot/Topbar/Fullscreen/Fullscreen.client.lua rename to Resources/GuiRoot/Topbar/Fullscreen/Fullscreen.client.lua diff --git a/Resources/GameJoin/GuiRoot/Topbar/Help/Help.client.lua b/Resources/GuiRoot/Topbar/Help/Help.client.lua similarity index 100% rename from Resources/GameJoin/GuiRoot/Topbar/Help/Help.client.lua rename to Resources/GuiRoot/Topbar/Help/Help.client.lua diff --git a/Resources/GuiRoot/init.meta.json b/Resources/GuiRoot/init.meta.json new file mode 100644 index 0000000..85529ff --- /dev/null +++ b/Resources/GuiRoot/init.meta.json @@ -0,0 +1,3 @@ +{ + "className": "ScreenGui" +} \ No newline at end of file diff --git a/UI/OldRootFrame.rbxmx b/Resources/RootFrame.rbxmx similarity index 100% rename from UI/OldRootFrame.rbxmx rename to Resources/RootFrame.rbxmx diff --git a/Resources/SafeChat/init.lua b/Resources/SafeChat/init.lua deleted file mode 100644 index 2c7a46a..0000000 --- a/Resources/SafeChat/init.lua +++ /dev/null @@ -1,35 +0,0 @@ -local safeChatTree = -{ - Label = "ROOT"; - Branches = {}; -} - -do - local mTreeData = script:WaitForChild("RawTreeData") - local treeData = require(mTreeData) - - local stack = {} - stack[0] = safeChatTree - - for line in treeData:gmatch("[^\n]+") do - if #line > 0 then - local stackIndex = 0 - while line:sub(1,1) == "\t" do - stackIndex = stackIndex + 1 - line = line:sub(2) - end - - local tree = stack[stackIndex] - assert(tree,"Bad safechat tree setup at depth " .. stackIndex .. ": " .. line) - - local branch = {} - branch.Label = line - branch.Branches = {} - table.insert(tree.Branches,branch) - - stack[stackIndex+1] = branch - end - end -end - -return safeChatTree \ No newline at end of file diff --git a/Server/Resources/CharacterAssets.rbxmx b/Server/Resources/CharacterAssets.rbxmx new file mode 100644 index 0000000..23f396a --- /dev/null +++ b/Server/Resources/CharacterAssets.rbxmx @@ -0,0 +1,143 @@ + + true + null + nil + + + + CharacterAssets + + + + + + + 0.960784376 + 0.80392158 + 0.188235298 + + + 0.960784376 + 0.80392158 + 0.188235298 + + + 0.643137276 + 0.741176486 + 0.278431386 + + BodyColors + + 0.960784376 + 0.80392158 + 0.188235298 + + + 0.643137276 + 0.741176486 + 0.278431386 + + + + 0.0509804003 + 0.411764711 + 0.674509823 + + + + + + + + 1 + 1 + 1 + + Pants + rbxassetid://1110695628 + + + + + + + + 1 + 1 + 1 + + Shirt + rbxassetid://1110695025 + + + + + + + + 1 + 1 + 1 + + + ShirtGraphic + + + + + + + 0 + 2 + 1112256772 + CL_LeftArm + 0 + + + + + + + 0 + 4 + 1112275294 + CL_LeftLeg + 0 + + + + + + + 0 + 3 + 1112244824 + CL_RightArm + 0 + + + + + + + 0 + 5 + 1112267576 + CL_RightLeg + 0 + + + + + + + 0 + 1 + 1112228624 + CL_Torso + 0 + + + + + \ No newline at end of file diff --git a/Server/Resources/InputGateway/Client.client.lua b/Server/Resources/InputGateway/Client.client.lua new file mode 100644 index 0000000..a61ce51 --- /dev/null +++ b/Server/Resources/InputGateway/Client.client.lua @@ -0,0 +1,185 @@ +local UserInputService = game:GetService("UserInputService") +local ContextActionService = game:GetService("ContextActionService") +local Debris = game:GetService("Debris") + +local gateway = script.Parent +local tool = gateway.Parent +local remote = gateway:WaitForChild("Gateway") +local player = game.Players.LocalPlayer +local mouse = player:GetMouse() +local isActive = false + +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +-- Standard Input +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + +local function activate(active,cf) + isActive = active + remote:FireServer("SetActive",active,cf) + while isActive do + wait(.1) + remote:FireServer("SetTarget",mouse.Hit) + end +end + +local function onKey(input) + local keyCode = input.KeyCode.Name + local down = (input.UserInputState.Name == "Begin") + remote:FireServer("KeyEvent",keyCode,down) +end + +local function onInputBegan(input,gameProcessed) + if not gameProcessed then + local name = input.UserInputType.Name + if name == "MouseButton1" then + activate(true,mouse.Hit) + elseif name == "Touch" then + wait(.1) + local state = input.UserInputState.Name + if state == "End" or state == "Cancel" then + activate(true,mouse.Hit) + end + elseif name == "Gamepad1" then + local keyCode = input.KeyCode.Name + if keyCode == "ButtonR2" then + activate(true,mouse.Hit) + end + elseif name == "Keyboard" then + onKey(input) + end + end +end + +local function onInputEnded(input,gameProcessed) + if not gameProcessed and isActive then + local name = input.UserInputType.Name + if name == "MouseButton1" or name == "Touch" or name == "Gamepad1" then + activate(false,mouse.Hit) + elseif name == "Keyboard" then + onKey(input) + end + end +end + +UserInputService.InputBegan:Connect(onInputBegan) +UserInputService.InputEnded:Connect(onInputEnded) + +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +-- Special case Input +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + +local mControlScheme = tool:WaitForChild("ControlScheme",5) + +if mControlScheme then + local controlSchemeData = require(mControlScheme) + local controlScheme = controlSchemeData.Buttons + local activateContext = controlSchemeData.ActivateContext + local keyEvent = tool:WaitForChild("KeyEvent") + local callbacks = {} + + local hands = { L = "Left", R = "Right" } + local handTypes = {"Bumper","Trigger","Joystick (Press)"} + + local schemeDocs = + { + Keyboard = {"Hold Left Mouse Button - " .. activateContext}; + Gamepad = {"Hold Right Trigger - " .. activateContext}; + } + + for key,data in pairs(controlScheme) do + local down = false + callbacks[key] = function (actionName,inputState,inputObject) + if (inputState.Name == "Begin") and not down then + down = true + if data.Client then + keyEvent:Fire(key,true) + else + remote:FireServer("KeyEvent",key,true) + end + elseif (inputState.Name == "End") and down then + down = false + if data.Client then + keyEvent:Fire(key,false) + else + remote:FireServer("KeyEvent",key,false) + end + end + end + + local xBtn = data.XboxButton:gsub("Button","") + if #xBtn == 2 then + local handId,hTypeId = xBtn:match("(%u)(%d)") + local hand = hands[handId] + local hType = handTypes[tonumber(hTypeId)] + xBtn = hand .. " " .. hType + else + xBtn = "(" .. xBtn .. ")" + end + table.insert(schemeDocs.Keyboard,key .. " - " .. data.Label) + table.insert(schemeDocs.Gamepad,xBtn .. " - " .. data.Label) + end + + local currentSchemeDocMsg + + local function onLastInputTypeChanged(inputType) + if currentSchemeDocMsg and not UserInputService.TouchEnabled and not controlSchemeData.HideControls then + local schemeDoc + if inputType.Name:find("Gamepad") then + schemeDoc = "Gamepad" + else + schemeDoc = "Keyboard" + end + currentSchemeDocMsg.Text = schemeDoc .. " Controls:\n\n" .. table.concat(schemeDocs[schemeDoc],"\n") + end + end + + local diedCon + local equipped = false + + local function onUnequipped() + if equipped then + equipped = false + for key,data in pairs(controlScheme) do + ContextActionService:UnbindAction(data.Label) + end + currentSchemeDocMsg:Destroy() + currentSchemeDocMsg = nil + end + end + + local function onEquipped() + if not equipped then + equipped = true + for key,data in pairs(controlScheme) do + ContextActionService:BindAction(data.Label,callbacks[key],true,Enum.KeyCode[data.XboxButton]) + ContextActionService:SetTitle(data.Label,data.Label) + end + if UserInputService.TouchEnabled then + spawn(function () + local playerGui = player:WaitForChild("PlayerGui") + local contextActionGui = playerGui:WaitForChild("ContextActionGui") + local contextButtonFrame = contextActionGui:WaitForChild("ContextButtonFrame") + contextButtonFrame.Size = UDim2.new(3/8,0,3/8,0) + contextButtonFrame.AnchorPoint = Vector2.new(1,1) + contextButtonFrame.Position = UDim2.new(1,0,1,0) + end) + end + currentSchemeDocMsg = Instance.new("Message") + currentSchemeDocMsg.Parent = player + onLastInputTypeChanged(UserInputService:GetLastInputType()) + if not diedCon then + local char = tool.Parent + if char then + local humanoid = char:FindFirstChildWhichIsA("Humanoid") + if humanoid then + diedCon = humanoid.Died:Connect(onUnequipped) + end + end + end + end + end + + tool.Equipped:Connect(onEquipped) + tool.Unequipped:Connect(onUnequipped) + UserInputService.LastInputTypeChanged:Connect(onLastInputTypeChanged) +end \ No newline at end of file diff --git a/Server/Resources/InputGateway/Gateway.model.json b/Server/Resources/InputGateway/Gateway.model.json new file mode 100644 index 0000000..41fddb3 --- /dev/null +++ b/Server/Resources/InputGateway/Gateway.model.json @@ -0,0 +1 @@ +{"ClassName": "RemoteEvent"} \ No newline at end of file diff --git a/Server/InputGateway.server.lua b/Server/Resources/InputGateway/Server.server.lua similarity index 100% rename from Server/InputGateway.server.lua rename to Server/Resources/InputGateway/Server.server.lua diff --git a/Shared/ServerStorage/PlayerDataStore.lua b/Server/Resources/PlayerDataStore.lua similarity index 100% rename from Shared/ServerStorage/PlayerDataStore.lua rename to Server/Resources/PlayerDataStore.lua diff --git a/Server/Badges.server.lua b/Server/Scripts/Badges.server.lua similarity index 100% rename from Server/Badges.server.lua rename to Server/Scripts/Badges.server.lua diff --git a/Server/Bevels.server.lua b/Server/Scripts/Bevels.server.lua similarity index 99% rename from Server/Bevels.server.lua rename to Server/Scripts/Bevels.server.lua index 485c5be..02e2068 100644 --- a/Server/Bevels.server.lua +++ b/Server/Scripts/Bevels.server.lua @@ -17,7 +17,7 @@ local enableBevels = getFlag("EnableBevels") local debugMode = getFlag("DevTestMode") local bevelCache = ServerStorage:FindFirstChild("BevelCache") -local bevelsReady = bevelCache:FindFirstChild("BevelsReady") +local bevelsReady = bevelCache and bevelCache:FindFirstChild("BevelsReady") if not bevelCache then bevelCache = Instance.new("Folder") @@ -37,7 +37,7 @@ if not enableBevels then return end -do +--[[do local coreBevelCache = ServerStorage:WaitForChild("CoreBevelCache") for _,bevel in pairs(coreBevelCache:GetChildren()) do @@ -48,7 +48,7 @@ do end coreBevelCache:Destroy() -end +end]] local regen = ServerStorage:FindFirstChild("Regeneration") diff --git a/Server/BuildTools/Dragger/init.client.lua b/Server/Scripts/BuildTools/Dragger/init.client.lua similarity index 100% rename from Server/BuildTools/Dragger/init.client.lua rename to Server/Scripts/BuildTools/Dragger/init.client.lua diff --git a/Server/BuildTools/Dragger/init.meta.json b/Server/Scripts/BuildTools/Dragger/init.meta.json similarity index 100% rename from Server/BuildTools/Dragger/init.meta.json rename to Server/Scripts/BuildTools/Dragger/init.meta.json diff --git a/Server/BuildTools/init.server.lua b/Server/Scripts/BuildTools/init.server.lua similarity index 100% rename from Server/BuildTools/init.server.lua rename to Server/Scripts/BuildTools/init.server.lua diff --git a/Server/CaptureTheFlag.server.lua b/Server/Scripts/CaptureTheFlag.server.lua similarity index 100% rename from Server/CaptureTheFlag.server.lua rename to Server/Scripts/CaptureTheFlag.server.lua diff --git a/Server/Characters.server.lua b/Server/Scripts/Characters.server.lua similarity index 79% rename from Server/Characters.server.lua rename to Server/Scripts/Characters.server.lua index 5305e23..e0ac689 100644 --- a/Server/Characters.server.lua +++ b/Server/Scripts/Characters.server.lua @@ -4,13 +4,12 @@ local InsertService = game:GetService("InsertService") local ReplicatedStorage = game:GetService("ReplicatedStorage") local ServerStorage = game:GetService("ServerStorage") -local hats = ServerStorage:WaitForChild("ServerHatCache") -local requestCharacter = ReplicatedStorage:WaitForChild("RequestCharacter") local assetUtil = require(ReplicatedStorage:WaitForChild("AssetUtil")) local itemData = ReplicatedStorage:WaitForChild("ItemData") local hatData = require(itemData:WaitForChild("Hat")) local playerDataGet = { Success = false } + pcall(function () playerDataGet = require(ServerStorage:WaitForChild("PlayerDataStore")) end) @@ -20,9 +19,16 @@ if not playerDataGet.Success then end local playerDataStore = playerDataGet.DataStore - local limbs = {"Head", "Torso", "LeftArm", "RightArm", "LeftLeg", "RightLeg"} +local requestCharacter = Instance.new("RemoteEvent") +requestCharacter.Name = "RequestCharacter" +requestCharacter.Parent = ReplicatedStorage + +local hats = Instance.new("Folder") +hats.Name = "ServerHatCache" +hats.Parent = ServerStorage + local function preBufferHat(hatId) local hat = hats:FindFirstChild(hatId) @@ -48,21 +54,22 @@ local function safeDestroy(obj) end local function onCharacterAdded(char) + local assets = ServerStorage.CharacterAssets local player = Players:GetPlayerFromCharacter(char) - local bodyColors = script.BodyColors:Clone() + local bodyColors = assets.BodyColors:Clone() CollectionService:AddTag(bodyColors, "RespectCharacterAsset") - local graphic = script.ShirtGraphic:Clone() + local graphic = assets.ShirtGraphic:Clone() local shirt = char:FindFirstChildWhichIsA("Shirt") if not shirt then - shirt = script.Shirt:Clone() + shirt = assets.Shirt:Clone() end local pants = char:FindFirstChildWhichIsA("Pants") if not pants then - pants = script.Pants:Clone() + pants = assets.Pants:Clone() end local faceId = 1104210678 @@ -70,15 +77,35 @@ local function onCharacterAdded(char) local humanoid = char:WaitForChild("Humanoid") CollectionService:AddTag(humanoid, "Animator") + CollectionService:AddTag(humanoid, "HumanoidSound") local function onDied() - if char:FindFirstChild("HumanoidRootPart") then - char.HumanoidRootPart:Destroy() + local fuse do + local rootPart = char:FindFirstChild("HumanoidRootPart") + local torso = char:FindFirstChild("Torso") + + if rootPart and torso then + fuse = Instance.new("WeldConstraint") + fuse.Part0 = torso + fuse.Part1 = rootPart + fuse.Parent = rootPart + end + end + + for _,desc in pairs(char:GetDescendants()) do + if desc:IsA("BasePart") then + for _,joint in pairs(desc:GetJoints()) do + if joint ~= fuse then + joint:Destroy() + end + end + end end wait(5) local player = game.Players:GetPlayerFromCharacter(char) + if player then player:LoadCharacter() end @@ -121,6 +148,7 @@ local function onCharacterAdded(char) if player.UserId > 0 and playerDataStore then local playerData = playerDataStore:GetSaveData(player) local colorData = playerData:Get("BodyColors") + if colorData then for _,limb in pairs(limbs) do local num = colorData[limb] @@ -131,19 +159,24 @@ local function onCharacterAdded(char) end local loadout = playerData:Get("Loadout") + if loadout then local shirtId = loadout.Shirt + local pantsId = loadout.Pants + if shirtId then shirt.ShirtTemplate = "rbxassetid://" .. shirtId end - local pantsId = loadout.Pants + if pantsId then pants.PantsTemplate = "rbxassetid://" .. pantsId end faceId = loadout.Face or faceId + spawn(function () local hatId = loadout.Hat or 0 + if hatId > 0 then local hatSrc = preBufferHat(hatId) local hat = hatSrc:Clone() @@ -156,7 +189,8 @@ local function onCharacterAdded(char) end if tshirtId > 0 then - local success,img = assetUtil:RequestImage(tshirtId) + local success, img = assetUtil:RequestImage(tshirtId) + if success and img then graphic.Graphic = img graphic.Parent = char @@ -169,6 +203,7 @@ local function onCharacterAdded(char) local head = char:WaitForChild("Head") local face = head:WaitForChild("face") + face.Texture = "rbxhttp://Game/Tools/ThumbnailAsset.ashx?fmt=png&wd=420&ht=420&aid=" .. faceId end @@ -180,15 +215,11 @@ end local function onPlayerAdded(player) player.CanLoadCharacterAppearance = false - player.CharacterAdded:connect(onCharacterAdded) + player.CharacterAdded:Connect(onCharacterAdded) if player.Character then onCharacterAdded(player.Character) end - - if game.JobId == "" then - player:LoadCharacter() - end end for _,v in pairs(Players:GetPlayers()) do diff --git a/Server/Chat.server.lua b/Server/Scripts/Chat.server.lua similarity index 86% rename from Server/Chat.server.lua rename to Server/Scripts/Chat.server.lua index da2f4c3..6229ee2 100644 --- a/Server/Chat.server.lua +++ b/Server/Scripts/Chat.server.lua @@ -1,12 +1,15 @@ +local Chat = game:GetService("Chat") local Players = game:GetService("Players") local TextService = game:GetService("TextService") -local Chat = game:GetService("Chat") local ReplicatedStorage = game:GetService("ReplicatedStorage") -local chatRemote = ReplicatedStorage:WaitForChild("ChatRemote") -local mSafeChatTree = ReplicatedStorage:WaitForChild("SafeChatTree") +local mSafeChatTree = ReplicatedStorage:WaitForChild("SafeChat") local safeChatTree = require(mSafeChatTree) +local chatRemote = Instance.new("RemoteEvent") +chatRemote.Name = "ChatRemote" +chatRemote.Parent = ReplicatedStorage + local filterCache = {} local maxChatLength = 128 diff --git a/Server/Cylinders/CylinderSurface.rbxmx b/Server/Scripts/Cylinders/CylinderSurface.rbxmx similarity index 100% rename from Server/Cylinders/CylinderSurface.rbxmx rename to Server/Scripts/Cylinders/CylinderSurface.rbxmx diff --git a/Server/Cylinders/init.server.lua b/Server/Scripts/Cylinders/init.server.lua similarity index 100% rename from Server/Cylinders/init.server.lua rename to Server/Scripts/Cylinders/init.server.lua diff --git a/Server/Explosions.server.lua b/Server/Scripts/Explosions.server.lua similarity index 99% rename from Server/Explosions.server.lua rename to Server/Scripts/Explosions.server.lua index 262d41d..b313efd 100644 --- a/Server/Explosions.server.lua +++ b/Server/Scripts/Explosions.server.lua @@ -6,6 +6,7 @@ local FORCE_GRANULARITY = 2 local allowTeamDamage = false local teamDamage = ServerStorage:FindFirstChild("TeamDamage") + if teamDamage then allowTeamDamage = teamDamage.Value end diff --git a/Server/ForceFields.server.lua b/Server/Scripts/ForceFields.server.lua similarity index 100% rename from Server/ForceFields.server.lua rename to Server/Scripts/ForceFields.server.lua diff --git a/Server/HatGranter.server.lua b/Server/Scripts/HatGranter.server.lua similarity index 89% rename from Server/HatGranter.server.lua rename to Server/Scripts/HatGranter.server.lua index bb99c84..fb0230d 100644 --- a/Server/HatGranter.server.lua +++ b/Server/Scripts/HatGranter.server.lua @@ -1,9 +1,12 @@ local ReplicatedStorage = game:GetService("ReplicatedStorage") +local ServerStorage = game:GetService("ServerStorage") + local itemData = ReplicatedStorage:WaitForChild("ItemData") local hatData = require(itemData:WaitForChild("Hat")) -local ServerStorage = game:GetService("ServerStorage") -local grantHatToUser = ServerStorage:WaitForChild("GrantHatToUser") +local grantHatToUser = Instance.new("BindableEvent") +grantHatToUser.Name = "GrantHatToUser" +grantHatToUser.Parent = ServerStorage local authTable = { diff --git a/Server/Heads.server.lua b/Server/Scripts/Heads.server.lua similarity index 100% rename from Server/Heads.server.lua rename to Server/Scripts/Heads.server.lua diff --git a/Server/Leaderboard.server.lua b/Server/Scripts/Leaderboard.server.lua similarity index 100% rename from Server/Leaderboard.server.lua rename to Server/Scripts/Leaderboard.server.lua diff --git a/Shared/ServerScriptService/LightingConfig.server.lua b/Server/Scripts/LightingConfig.server.lua similarity index 100% rename from Shared/ServerScriptService/LightingConfig.server.lua rename to Server/Scripts/LightingConfig.server.lua diff --git a/Server/LoadTools.server.lua b/Server/Scripts/LoadTools.server.lua similarity index 52% rename from Server/LoadTools.server.lua rename to Server/Scripts/LoadTools.server.lua index 90b84f1..97c397e 100644 --- a/Server/LoadTools.server.lua +++ b/Server/Scripts/LoadTools.server.lua @@ -2,17 +2,19 @@ local ServerStorage = game:GetService("ServerStorage") local StarterPack = game:GetService("StarterPack") local Players = game:GetService("Players") -local standardTools = ServerStorage:WaitForChild("StandardTools") +local tools = ServerStorage:WaitForChild("Tools") local loadTools = ServerStorage:FindFirstChild("LoadTools") if loadTools then for toolName in loadTools.Value:gmatch("[^;]+") do - local tool = standardTools:WaitForChild(toolName) + local tool = tools:WaitForChild(toolName) tool:Clone().Parent = StarterPack - for _,v in pairs(Players:GetPlayers()) do - if v:FindFirstChild("Backpack") and not v:FindFirstChild(tool.Name) then - tool:Clone().Parent = v.Backpack + for _,player in pairs(Players:GetPlayers()) do + local backpack = player:FindFirstChildOfClass("Backpack") + + if backpack and not backpack:FindFirstChild(tool.Name) then + tool:Clone().Parent = backpack end end end diff --git a/Server/Parts.server.lua b/Server/Scripts/Parts.server.lua similarity index 96% rename from Server/Parts.server.lua rename to Server/Scripts/Parts.server.lua index 2f0c951..dbfd2be 100644 --- a/Server/Parts.server.lua +++ b/Server/Scripts/Parts.server.lua @@ -205,6 +205,7 @@ local function applyCharacter(humanoid) local model = humanoid.Parent if not CollectionService:HasTag(humanoid, "Classified") then + local characterAssets = ServerStorage.CharacterAssets CollectionService:AddTag(humanoid, "Classified") for _,v in pairs(model:GetDescendants()) do @@ -213,9 +214,9 @@ local function applyCharacter(humanoid) end end - for _,v in pairs(script:GetChildren()) do - if v:IsA("CharacterMesh") then - local copy = v:Clone() + for _,child in pairs(characterAssets:GetChildren()) do + if child:IsA("CharacterMesh") then + local copy = child:Clone() copy.Parent = model CollectionService:AddTag(copy, "NoCharacterBevels") end @@ -223,11 +224,11 @@ local function applyCharacter(humanoid) delay(1, function () if not model:FindFirstChildWhichIsA("Shirt") then - script.Shirt:Clone().Parent = model + characterAssets.Shirt:Clone().Parent = model end if not model:FindFirstChildWhichIsA("Pants") then - script.Pants:Clone().Parent = model + characterAssets.Pants:Clone().Parent = model end end) end diff --git a/Server/Regeneration.server.lua b/Server/Scripts/Regeneration.server.lua similarity index 100% rename from Server/Regeneration.server.lua rename to Server/Scripts/Regeneration.server.lua diff --git a/Server/SessionTracker.server.lua b/Server/Scripts/SessionTracker.server.lua similarity index 100% rename from Server/SessionTracker.server.lua rename to Server/Scripts/SessionTracker.server.lua diff --git a/Server/Time.server.lua b/Server/Scripts/Time.server.lua similarity index 100% rename from Server/Time.server.lua rename to Server/Scripts/Time.server.lua diff --git a/Shared/ReplicatedStorage/AssetUtil.lua b/Shared/AssetUtil.lua similarity index 69% rename from Shared/ReplicatedStorage/AssetUtil.lua rename to Shared/AssetUtil.lua index b8cae5e..38de2a2 100644 --- a/Shared/ReplicatedStorage/AssetUtil.lua +++ b/Shared/AssetUtil.lua @@ -8,16 +8,19 @@ local AssetUtil = } local assetTypes = {} + for _,assetType in pairs(Enum.AssetType:GetEnumItems()) do assetTypes[assetType.Value] = assetType.Name end function AssetUtil:SafeCall(class,method,...) local success,response - local tries = 0 + local tries = 0 + while not success do - success,response = pcall(class[method],class,...) - if not success then + success, response = pcall(class[method], class, ...) + + if not success then if response:find("400") then success = true response = false @@ -28,16 +31,19 @@ function AssetUtil:SafeCall(class,method,...) end end end - end - return success,response + end + + return success, response end function AssetUtil:Import(assetId) - local success,model = self:SafeCall(InsertService,"LoadAsset",assetId) + local success, model = self:SafeCall(InsertService, "LoadAsset", assetId) + if success then local objects = model:GetChildren() - return true,unpack(objects) - end + return true, unpack(objects) + end + return false end @@ -47,11 +53,13 @@ function AssetUtil:RequestImage(assetId) assert(assetId > 0) if self.TextureCache[assetId] == nil then - local success,response = self:SafeCall(MarketplaceService,"GetProductInfo",assetId) + local success, response = self:SafeCall(MarketplaceService, "GetProductInfo", assetId) if success then - local result + local result + if response then - local assetType = assetTypes[response.AssetTypeId] + local assetType = assetTypes[response.AssetTypeId] + if assetType == "Image" then -- No transformation needed! result = "rbxassetid://" .. assetId elseif assetType == "TeeShirt" then @@ -60,19 +68,20 @@ function AssetUtil:RequestImage(assetId) result = shirtGraphic.Graphic end elseif assetType == "Decal" or assetType == "Face" then - local imported,decal = self:Import(assetId) + local imported, decal = self:Import(assetId) if imported then result = decal.Texture end end else result = "" - end + end + self.TextureCache[assetId] = result end end - return true,self.TextureCache[assetId] + return true, self.TextureCache[assetId] end return AssetUtil \ No newline at end of file diff --git a/Shared/ReplicatedStorage/BrickColors.lua b/Shared/BrickColors.lua similarity index 100% rename from Shared/ReplicatedStorage/BrickColors.lua rename to Shared/BrickColors.lua diff --git a/Shared/ReplicatedStorage/ItemData/Face.lua b/Shared/ItemData/Face.lua similarity index 100% rename from Shared/ReplicatedStorage/ItemData/Face.lua rename to Shared/ItemData/Face.lua diff --git a/Shared/ReplicatedStorage/ItemData/Hat.lua b/Shared/ItemData/Hat.lua similarity index 100% rename from Shared/ReplicatedStorage/ItemData/Hat.lua rename to Shared/ItemData/Hat.lua diff --git a/Shared/ReplicatedStorage/ItemData/Pants.lua b/Shared/ItemData/Pants.lua similarity index 100% rename from Shared/ReplicatedStorage/ItemData/Pants.lua rename to Shared/ItemData/Pants.lua diff --git a/Shared/ReplicatedStorage/ItemData/Shirt.lua b/Shared/ItemData/Shirt.lua similarity index 100% rename from Shared/ReplicatedStorage/ItemData/Shirt.lua rename to Shared/ItemData/Shirt.lua diff --git a/Shared/ReplicatedStorage/PlaceData.lua b/Shared/PlaceData.lua similarity index 100% rename from Shared/ReplicatedStorage/PlaceData.lua rename to Shared/PlaceData.lua diff --git a/Shared/ReplicatedStorage/Client/Moon.lua b/Shared/ReplicatedStorage/Client/Moon.lua deleted file mode 100644 index b40a7f1..0000000 --- a/Shared/ReplicatedStorage/Client/Moon.lua +++ /dev/null @@ -1,24 +0,0 @@ -return function (script) - local RunService = game:GetService("RunService") - local Lighting = game:GetService("Lighting") - local TeleportService = game:GetService("TeleportService") - - local c = workspace.CurrentCamera - local moon = script:WaitForChild("Moon") - moon.Locked = true - moon.Size = Vector3.new(50,50,1) - - local function moonUpdate() - if TeleportService:GetTeleportSetting("ClassicSky") then - local pos = Lighting:GetMoonDirection() * 900 - local origin = c.CFrame.p - moon.Parent = c - moon.CFrame = CFrame.new(origin+pos, origin) - else - moon.Parent = nil - end - end - - RunService:BindToRenderStep("MoonUpdate",201,moonUpdate) - return 1 -end \ No newline at end of file diff --git a/Shared/ReplicatedStorage/Client/Mouse.lua b/Shared/ReplicatedStorage/Client/Mouse.lua deleted file mode 100644 index 975b019..0000000 --- a/Shared/ReplicatedStorage/Client/Mouse.lua +++ /dev/null @@ -1,133 +0,0 @@ -local UserInputService = game:GetService("UserInputService") -local RunService = game:GetService("RunService") -local GuiService = game:GetService("GuiService") -local Players = game:GetService("Players") - ------------------------------------------------------------------ - -local inGuiFocus = false -local inputQueue = {} - -local function checkGuiFocus() - inGuiFocus = (next(inputQueue) ~= nil) -end - -local function onInputChanged(input,gameProcessed) - if input.UserInputType == Enum.UserInputType.MouseMovement then - inputQueue[input] = gameProcessed or nil - checkGuiFocus() - end -end - -UserInputService.InputChanged:Connect(onInputChanged) - ------------------------------------------------------------------ - -local activated = false -local player = Players.LocalPlayer -local mouseGui - -local function onInputBegan(input,gameProcessed) - if mouseGui then - if input.UserInputType == Enum.UserInputType.Touch and not gameProcessed then - wait(.1) - if input.UserInputState == Enum.UserInputState.End then - activated = true - else - mouseGui.ImageTransparency = 1 - end - end - end -end - -UserInputService.InputBegan:Connect(onInputBegan) - ------------------------------------------------------------------ - -local GUN_WAIT_CURSOR = "rbxasset://textures/GunWaitCursor.png" -local GUN_CURSOR = "rbxasset://textures/GunCursor.png" -local IS_TOUCH = UserInputService.TouchEnabled - -return function (script) - mouseGui = script.Parent - - local hasTool = mouseGui:WaitForChild("HasTool") - UserInputService.MouseIconEnabled = false - - local canActivate = true - - if UserInputService.TouchEnabled then - local c = workspace.CurrentCamera - local playerGui = player:WaitForChild("PlayerGui") - local touchGui = playerGui:WaitForChild("TouchGui") - local touchFrame = touchGui:WaitForChild("TouchControlFrame") - if c.ViewportSize.Y < 600 then - touchFrame.Size = UDim2.new(0.85,0,0.8,0) - else - touchFrame.Size = UDim2.new(0.9,0,0.9,0) - end - touchFrame.Position = UDim2.new(0.05,0,0,0) - end - - local function updateMouse() - local char = player.Character - local tool - local override = false - if char then - tool = char:FindFirstChildWhichIsA("Tool") - hasTool.Value = (tool ~= nil) - if tool then - if tool:FindFirstChild("IconOverride") then - if tool.IconOverride.Value ~= "" then - mouseGui.Image = tool.IconOverride.Value - else - mouseGui.Image = "rbxassetid://1000000" - end - elseif tool.Enabled then - mouseGui.Image = GUN_CURSOR - if IS_TOUCH then - canActivate = true - mouseGui.ImageTransparency = 1 - end - else - mouseGui.Image = GUN_WAIT_CURSOR - end - end - else - hasTool.Value = false - end - if inGuiFocus then - mouseGui.Image = "rbxassetid://1000000" - end - - local guiInset = GuiService:GetGuiInset() - local pos = UserInputService:GetMouseLocation() - guiInset - local upos = UDim2.new(0,pos.X,0,pos.Y) - - if IS_TOUCH then - if hasTool.Value then - mouseGui.Visible = true - if activated and mouseGui.Image == GUN_WAIT_CURSOR then - if canActivate then - canActivate = false - mouseGui.Position = upos - mouseGui.ImageTransparency = -1 - end - activated = false - else - mouseGui.ImageTransparency = math.min(1,mouseGui.ImageTransparency + 0.01) - end - else - mouseGui.Visible = false - end - else - mouseGui.Position = upos - end - - if UserInputService.MouseIconEnabled then - UserInputService.MouseIconEnabled = false - end - end - - RunService:BindToRenderStep("UpdateMouse",1000,updateMouse) -end \ No newline at end of file diff --git a/Shared/ReplicatedStorage/Client/Sky.lua b/Shared/ReplicatedStorage/Client/Sky.lua deleted file mode 100644 index a423fce..0000000 --- a/Shared/ReplicatedStorage/Client/Sky.lua +++ /dev/null @@ -1,146 +0,0 @@ -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --- Services - -local Lighting = game:GetService("Lighting") -local RunService = game:GetService("RunService") -local TeleportService = game:GetService("TeleportService") -local UserInputService = game:GetService("UserInputService") - -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --- Sky Colors - -local midnight = 0 -local day = 86400 -local hour = day/24 - -local sunRise = day * .25 -local sunSet = day * .75 -local riseAndSetTime = hour/2 - -local times = -{ - midnight; - sunRise - hour; - sunRise - riseAndSetTime; - sunRise; - sunRise + riseAndSetTime; - sunSet - riseAndSetTime; - sunSet; - sunSet + (hour/3); - day; -} - -local colors = -{ - Color3.new(); - Color3.new(); - Color3.new(.2, .15, .01); - Color3.new(.2, .15, .01); - Color3.new(1, 1, 1); - Color3.new(1, 1, 1); - Color3.new(.4, .2, .05); - Color3.new(); - Color3.new(); -} - -local function linearSpline(x,times,values) - assert(#times == #values) - if #values == 1 or x < times[1] then - return values[1] - end - - for i = 2, #times do - if x < times[i] then - local alpha = (times[i] - x) / (times[i] - times[i-1]) - return values[i-1]:lerp(values[i], 1-alpha) - end - end - - return values[#values] -end - -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - -local lastTime = 0 -local c = workspace.CurrentCamera - -local function r() - return -1 + (math.random()*2) -end - -local skyAdorn = script:WaitForChild("SkyAdorn") -local night = skyAdorn:WaitForChild("Night") -local nightFrame = night:WaitForChild("NightFrame") -local star = script:WaitForChild("Star") - -if UserInputService.TouchEnabled then - -- TODO: Get rid of this when shadow-mapping is available - -- on mobile or the tone mapping is corrected. - - spawn(function () - local legacyToneMap = Lighting:WaitForChild("LegacyToneMap") - legacyToneMap:Destroy() - end) -end - -return function (script) - local shadowsOn = true - - for i = 1,500 do - local bb = star:Clone() - bb.StudsOffsetWorldSpace = Vector3.new(r(), r(), r()).Unit * 2500 - bb.Size = UDim2.new(0, math.random(2, 5), 0, math.random(2, 5)) - bb.Adornee = skyAdorn - bb.Parent = skyAdorn - end - - local function updateSky() - local shadowState = TeleportService:GetTeleportSetting("StencilShadows") - - if shadowState == nil then - TeleportService:SetTeleportSetting("StencilShadows", true) - shadowState = true - end - - if shadowState ~= shadowsOn then - shadowsOn = shadowState - - if shadowsOn then - local black = Color3.new() - Lighting.GlobalShadows = true - Lighting.Ambient = black:Lerp(Lighting.OutdoorAmbient, 0.5) - else - Lighting.GlobalShadows = false - Lighting.Ambient = Lighting.OutdoorAmbient - end - end - - - - if TeleportService:GetTeleportSetting("ClassicSky") then - local seconds = Lighting:GetMinutesAfterMidnight() * 60 - - if seconds < 0 then - seconds = day + seconds - end - - if seconds ~= lastTime then - local sunDir = game.Lighting:GetSunDirection() - local skyColor = linearSpline(seconds, times, colors) - nightFrame.BackgroundColor3 = skyColor - nightFrame.BackgroundTransparency = math.clamp((sunDir.Y + .033) * 10, 0, 1) - lastTime = seconds - end - - local sunDir = Lighting:GetSunDirection() - skyAdorn.CFrame = CFrame.new(c.CFrame.p) * CFrame.new(Vector3.new(), sunDir) - skyAdorn.Parent = (nightFrame.BackgroundTransparency < 1 and c or nil) - else - skyAdorn.Parent = nil - end - end - - RunService:BindToRenderStep("UpdateSky", 201, updateSky) -end - -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- \ No newline at end of file diff --git a/Resources/SafeChat/RawTreeData.lua b/Shared/SafeChat/RawTreeData.txt similarity index 99% rename from Resources/SafeChat/RawTreeData.lua rename to Shared/SafeChat/RawTreeData.txt index df39095..00639e3 100644 --- a/Resources/SafeChat/RawTreeData.lua +++ b/Shared/SafeChat/RawTreeData.txt @@ -1,4 +1,3 @@ -return [==[ Hello Hi Hi there! @@ -443,5 +442,4 @@ Ok :-( :D :-O - lol -]==] \ No newline at end of file + lol \ No newline at end of file diff --git a/Shared/SafeChat/init.lua b/Shared/SafeChat/init.lua new file mode 100644 index 0000000..f3f06c7 --- /dev/null +++ b/Shared/SafeChat/init.lua @@ -0,0 +1,38 @@ +local safeChatTree = +{ + Label = "ROOT"; + Branches = {}; +} + +do + local treeData = script:WaitForChild("RawTreeData") + treeData = treeData.Value + + local stack = {} + stack[0] = safeChatTree + + for line in treeData:gmatch("[^\n]+") do + if #line > 0 then + local stackIndex = 0 + + while line:sub(1, 1) == "\t" do + stackIndex = stackIndex + 1 + line = line:sub(2) + end + + local tree = stack[stackIndex] + assert(tree, "Bad safechat tree setup at depth " .. stackIndex .. ": " .. line) + + local branch = + { + Label = line, + Branches = {} + } + + table.insert(tree.Branches, branch) + stack[stackIndex + 1] = branch + end + end +end + +return safeChatTree \ No newline at end of file diff --git a/Shared/init.lua b/Shared/init.lua deleted file mode 100644 index f075e68..0000000 --- a/Shared/init.lua +++ /dev/null @@ -1,18 +0,0 @@ -if game.JobId ~= "" and game.GameId ~= 123949867 then - return -end - -for _,serviceBin in pairs(script:GetChildren()) do - local className = serviceBin.Name - local service = game:FindFirstChildWhichIsA(className, true) - - if not service then - service = game:GetService(className) - end - - for _,child in pairs(serviceBin:GetChildren()) do - child.Parent = service - end -end - -return 1 \ No newline at end of file diff --git a/Tools/GravityHammer/init.meta.json b/Tools/GravityHammer/init.meta.json index 0b8e1f3..bb682dd 100644 --- a/Tools/GravityHammer/init.meta.json +++ b/Tools/GravityHammer/init.meta.json @@ -4,7 +4,16 @@ "properties": { "CanBeDropped": false, - "GripPos": [0, 0, -3.25], + + "Grip": + [ + 0, 0, -3.25, + + 0, 0, 1, + 1, 0, 0, + 0, 1, 0 + ], + "TextureId": "rbxassetid://1256305" } } \ No newline at end of file diff --git a/Tools/PaintballGun/Paintball/init.server.lua b/Tools/PaintballGun/Paintball/init.server.lua index e03adf0..4317030 100644 --- a/Tools/PaintballGun/Paintball/init.server.lua +++ b/Tools/PaintballGun/Paintball/init.server.lua @@ -1,3 +1,5 @@ +local Debris = game:GetService("Debris") + ball = script.Parent damage = 20 @@ -24,9 +26,8 @@ function onTouched(hit) s.Velocity = 15 * v s.CFrame = CFrame.new(ball.Position + v, v) - ball.BrickCleanup:clone().Parent = s + Debris:AddItem(s, 24) - s.BrickCleanup.Disabled = false s.Parent = game.Workspace end @@ -67,7 +68,6 @@ function tagHumanoid(humanoid) end end - function untagHumanoid(humanoid) if humanoid ~= nil then local tag = humanoid:findFirstChild("creator") diff --git a/Tools/PaintballGun/PaintballShooter.server.lua b/Tools/PaintballGun/PaintballShooter.server.lua index dd96bb6..9cd07b9 100644 --- a/Tools/PaintballGun/PaintballShooter.server.lua +++ b/Tools/PaintballGun/PaintballShooter.server.lua @@ -1,3 +1,4 @@ +local Debris = game:GetService("Debris") local Tool = script.Parent local fireSound = Instance.new("Sound") @@ -9,22 +10,15 @@ fireSound.Parent = Tool.Handle local colors = {45, 119, 21, 24, 23, 105, 104} -function fire(v) - - fireSound:play() +local function fire(v) + fireSound:Play() - local vCharacter = Tool.Parent local vPlayer = game.Players:playerFromCharacter(vCharacter) local missile = Instance.new("Part") - - local spawnPos = vCharacter.PrimaryPart.Position - - - spawnPos = spawnPos + (v * 8) missile.Position = spawnPos @@ -43,9 +37,7 @@ function fire(v) force.force = Vector3.new(0,45,0) force.Parent = missile - Tool.BrickCleanup:clone().Parent = missile - - local new_script = script.Parent.Paintball:clone() + local new_script = Tool.Paintball:clone() new_script.Disabled = false new_script.Parent = missile @@ -54,10 +46,10 @@ function fire(v) creator_tag.Name = "creator" creator_tag.Parent = missile - - missile.Parent = game.Workspace missile:SetNetworkOwner(vPlayer) + + Debris:AddItem(missile, 24) end diff --git a/Tools/RocketLauncher/ServerLauncher.server.lua b/Tools/RocketLauncher/ServerLauncher.server.lua index 7240835..d937e08 100644 --- a/Tools/RocketLauncher/ServerLauncher.server.lua +++ b/Tools/RocketLauncher/ServerLauncher.server.lua @@ -1,5 +1,5 @@ local Tool = script.Parent -local Sound = Tool.Sound +local Sounds = Tool.Sounds local Rocket = Instance.new("Part") Rocket.Locked = true @@ -13,8 +13,8 @@ Rocket.Size = Vector3.new(1,1,4) Rocket.BrickColor = BrickColor.new(23) Tool.RocketScript:clone().Parent = Rocket -Sound.Explosion:clone().Parent = Rocket -Sound.Swoosh:clone().Parent = Rocket +Sounds.Explosion:clone().Parent = Rocket +Sounds.Swoosh:clone().Parent = Rocket function fire(vTarget) diff --git a/Tools/Timebomb/init.meta.json b/Tools/Timebomb/init.meta.json index e97aecd..f0ee7b4 100644 --- a/Tools/Timebomb/init.meta.json +++ b/Tools/Timebomb/init.meta.json @@ -3,6 +3,14 @@ "properties": { + "Grip": + [ + 0, 0, 0, + 1, 0, 0, + 0, 0, -1, + 0, 1, 0 + ], + "TextureId": "rbxasset://Textures/Bomb.png" } } \ No newline at end of file diff --git a/Tools/Trowel/WallMaker.server.lua b/Tools/Trowel/WallMaker.server.lua index e6fc5bc..06df124 100644 --- a/Tools/Trowel/WallMaker.server.lua +++ b/Tools/Trowel/WallMaker.server.lua @@ -1,35 +1,37 @@ -local wallHeight = 4 +local Debris = game:GetService("Debris") +local ReplicatedStorage = game:GetService("ReplicatedStorage") + local brickSpeed = 0.04 +local wallHeight = 4 local wallWidth = 12 local Tool = script.Parent - -local ReplicatedStorage = game:GetService("ReplicatedStorage") -local brickColors = require(ReplicatedStorage:WaitForChild("BrickColors")) - +local BrickColors = require(ReplicatedStorage:WaitForChild("BrickColors")) -- places a brick at pos and returns the position of the brick's opposite corner -function placeBrick(cf, pos, color) +local function placeBrick(cf, pos, color) local brick = Instance.new("Part") brick.BrickColor = color brick.CFrame = cf * CFrame.new(pos + brick.Size / 2) - script.Parent.BrickCleanup:Clone().Parent = brick -- attach cleanup script to this brick - brick.BrickCleanup.Disabled = false - brick.Parent = game.Workspace + brick.Parent = workspace + Debris:AddItem(brick, 24) + return brick, pos + brick.Size end -function buildWall(cf) - - local color = BrickColor.new(brickColors[math.random(1,#brickColors)]) +local function buildWall(cf) + local color = BrickColor.new(BrickColors[math.random(1, #BrickColors)]) local bricks = {} - assert(wallWidth>0) + assert(wallWidth > 0) + local y = 0 + while y < wallHeight do local p - local x = -wallWidth/2 - while x < wallWidth/2 do + local x = -wallWidth / 2 + + while x < wallWidth / 2 do local brick brick, p = placeBrick(cf, Vector3.new(x, y, 0), color) x = p.x @@ -37,60 +39,58 @@ function buildWall(cf) brick:MakeJoints() wait(brickSpeed) end + y = p.y end - - --workspace:UnjoinFromOutsiders(bricks) - return bricks + return bricks end function snap(v) - if math.abs(v.x)>math.abs(v.z) then - if v.x>0 then - return Vector3.new(1,0,0) + if math.abs(v.X) > math.abs(v.Z) then + if v.X > 0 then + return Vector3.new(1, 0, 0) else - return Vector3.new(-1,0,0) + return Vector3.new(-1, 0, 0) end else - if v.z>0 then - return Vector3.new(0,0,1) + if v.Z > 0 then + return Vector3.new(0, 0, 1) else - return Vector3.new(0,0,-1) + return Vector3.new(0, 0, -1) end end end - Tool.Enabled = true -function onActivated() +function onActivated() if not Tool.Enabled then return end Tool.Enabled = false - local character = Tool.Parent; + local character = Tool.Parent local humanoid = character.Humanoid + if humanoid == nil then print("Humanoid not found") return end local targetPos = humanoid.TargetPoint - local lookAt = snap( (targetPos - character.Head.Position).unit ) + local lookAt = snap( (targetPos - character.Head.Position).Unit ) local cf = CFrame.new(targetPos, targetPos + lookAt) - Tool.Handle.BuildSound:play() + Tool.Handle.BuildSound:Play() buildWall(cf) - wait(5) Tool.Enabled = true end -script.Parent.Activated:connect(onActivated) +Tool.Activated:Connect(onActivated) diff --git a/UI/Backpack/Backdrop.model.json b/UI/Backpack/Backdrop.model.json new file mode 100644 index 0000000..a9d03ff --- /dev/null +++ b/UI/Backpack/Backdrop.model.json @@ -0,0 +1,11 @@ +{ + "ClassName": "Frame", + + "Properties": + { + "BackgroundColor3": [0.706, 0.706, 0.706], + "BackgroundTransparency": 0.5, + "Size": [0, 0, 1, 0], + "ZIndex": 0 + } +} \ No newline at end of file diff --git a/UI/Backpack/Backpack.client.lua b/UI/Backpack/Backpack.client.lua index 6be5ed8..1fdcb19 100644 --- a/UI/Backpack/Backpack.client.lua +++ b/UI/Backpack/Backpack.client.lua @@ -5,34 +5,35 @@ ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- Setup -local ui = script.Parent -local rootFrame = ui:WaitForChild("RootFrame") - -local self = rootFrame:WaitForChild("Backpack") -local slotTemp = script:WaitForChild("SlotTemp") +local Players = game:GetService("Players") +local self = script.Parent local backdrop = self:WaitForChild("Backdrop") local slotsBin = self:WaitForChild("Slots") -local player = game.Players.LocalPlayer +local slotTemp = slotsBin:WaitForChild("Template") +slotTemp.Parent = nil + +local player = Players.LocalPlayer local UserInputService = game:GetService("UserInputService") local toolIndex = 0 local tools = {} local slots = {} + local tokens = { - One = 1; - Two = 2; + One = 1; + Two = 2; Three = 3; - Four = 4; - Five = 5; - Six = 6; + Four = 4; + Five = 5; + Six = 6; Seven = 7; Eight = 8; - Nine = 9; - Zero = 10; -- shhh not a hack + Nine = 9; + Zero = 10; -- shhh not a hack } ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- @@ -44,6 +45,7 @@ local numPress = eNumPress.Event -- Hack to work around the inputs being overridden while the Plane tool is active. local function allowGameProcessedBypassHack() local lastInputType = UserInputService:GetLastInputType() + if lastInputType.Name == "Gamepad1" then local char = player.Character if char then @@ -53,6 +55,7 @@ local function allowGameProcessedBypassHack() end end end + return false end @@ -60,6 +63,7 @@ local function onInputBegan(input,gameProcessed) if not gameProcessed or allowGameProcessedBypassHack() then local name = input.UserInputType.Name local keyCode = input.KeyCode.Name + if name == "Keyboard" then local toIndex = tokens[keyCode] if toIndex then @@ -68,12 +72,13 @@ local function onInputBegan(input,gameProcessed) elseif name == "Gamepad1" then if keyCode == "ButtonL1" or keyCode == "ButtonR1" then local nextIndex = toolIndex + if keyCode == "ButtonL1" then nextIndex = nextIndex - 1 elseif keyCode == "ButtonR1" then nextIndex = nextIndex + 1 end - print(nextIndex,#tools) + if nextIndex > 0 and nextIndex <= #tools then eNumPress:Fire(nextIndex) else @@ -89,18 +94,19 @@ UserInputService.InputBegan:connect(onInputBegan) ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- local function resortSlots() - for index,tool in ipairs(tools) do + for index, tool in ipairs(tools) do local slot = slots[tool] slot.Index.Text = index slot.LayoutOrder = index slot.Visible = true end - backdrop.Size = UDim2.new(#tools,0,1,0) + + backdrop.Size = UDim2.new(#tools, 0, 1, 0) end local function createSlot(tool) if not slots[tool] then - local index = #tools+1 + local index = #tools + 1 tools[index] = tool local slot = slotTemp:clone() @@ -109,6 +115,7 @@ local function createSlot(tool) local textHover = slot:WaitForChild("TextHover") local selectionOutline = slot:WaitForChild("SelectionOutline") + local toolIcon = slot:WaitForChild("ToolIcon") local indexLbl = slot:WaitForChild("Index") local toolName = slot:WaitForChild("ToolName") @@ -127,7 +134,7 @@ local function createSlot(tool) table.remove(tools, currentIndex) for _,con in pairs(conReg) do - con:disconnect() + con:Disconnect() end slots[tool] = nil @@ -167,24 +174,27 @@ local function createSlot(tool) end if tool.TextureId ~= "" then textHover.Visible = false + if isHovering then toolIcon.BackgroundTransparency = 0 if isDown then - toolIcon.BackgroundColor3 = Color3.new(0,0,1) + toolIcon.BackgroundColor3 = Color3.new(0, 0, 1) else - toolIcon.BackgroundColor3 = Color3.new(1,1,0) + toolIcon.BackgroundColor3 = Color3.new(1, 1, 0) end else toolIcon.BackgroundTransparency = 1 end else textHover.Visible = true + if isHovering then textHover.BackgroundTransparency = 0 + if isDown then - textHover.BackgroundColor3 = Color3.new(1,1,0) + textHover.BackgroundColor3 = Color3.new(1, 1, 0) else - textHover.BackgroundColor3 = Color3.new(0.706,0.706,0.706) + textHover.BackgroundColor3 = Color3.fromRGB(180, 180, 180) end else textHover.BackgroundTransparency = 1 @@ -198,12 +208,14 @@ local function createSlot(tool) elseif input.UserInputType.Name == "MouseMovement" or input.UserInputType.Name == "Touch" then isHovering = true end + renderUpdate() end local function onInputEnded(input) if input.UserInputType.Name == "MouseButton1" then isDown = false + if isHovering then toggleTool() end @@ -286,8 +298,8 @@ local function onCharacterAdded(char) onChildAdded(v) end - char.ChildAdded:connect(onChildAdded) - backpack.ChildAdded:connect(onChildAdded) + char.ChildAdded:Connect(onChildAdded) + backpack.ChildAdded:Connect(onChildAdded) end end @@ -295,6 +307,4 @@ if player.Character then onCharacterAdded(player.Character) end -player.CharacterAdded:connect(onCharacterAdded) - -game.StarterGui.ResetPlayerGuiOnSpawn = false \ No newline at end of file +player.CharacterAdded:Connect(onCharacterAdded) \ No newline at end of file diff --git a/UI/Backpack/Slots/ListSlots.model.json b/UI/Backpack/Slots/ListSlots.model.json new file mode 100644 index 0000000..2467784 --- /dev/null +++ b/UI/Backpack/Slots/ListSlots.model.json @@ -0,0 +1,9 @@ +{ + "ClassName": "UIListLayout", + + "Properties": + { + "FillDirection": "Horizontal", + "SortOrder": "LayoutOrder" + } +} \ No newline at end of file diff --git a/UI/Backpack/SlotTemp.rbxmx b/UI/Backpack/Slots/Template.rbxmx similarity index 53% rename from UI/Backpack/SlotTemp.rbxmx rename to UI/Backpack/Slots/Template.rbxmx index ab23d35..6800799 100644 --- a/UI/Backpack/SlotTemp.rbxmx +++ b/UI/Backpack/Slots/Template.rbxmx @@ -1,5 +1,6 @@ - + true + true @@ -10,15 +11,15 @@ false true - 0.7058824 - 0.7058824 - 0.7058824 + 0.70588237 + 0.70588237 + 0.70588237 1 - 0.1058824 - 0.1647059 - 0.2078432 + 0.105882399 + 0.164705902 + 0.207843199 0 0 @@ -28,7 +29,7 @@ 0 1 false - SlotTemp + Template null null null @@ -55,9 +56,9 @@ - 0.1058824 - 0.1647059 - 0.2078432 + 0.105882399 + 0.164705902 + 0.207843199 false 14 @@ -74,9 +75,8 @@ 1 false 1 - true - + true @@ -86,15 +86,15 @@ true - 0.6666667 - 0.6666667 - 0.6666667 + 0.666666687 + 0.666666687 + 0.666666687 0 - 0.1058824 - 0.1647059 - 0.2078432 + 0.105882399 + 0.164705902 + 0.207843199 0 0 @@ -109,9 +109,9 @@ null null - 0.03 + 0.0299999993 2 - 0.97 + 0.970000029 -2 null @@ -119,9 +119,9 @@ false null - 0.2 + 0.200000003 0 - 0.2 + 0.200000003 0 2 @@ -139,298 +139,17 @@ 1 1 - 0.8 + 0.800000012 0 0 true 2 1 true - 3 - true - - - - - 20 - 1 - UITextSizeConstraint - - true - - - - - - false - - 0 - 0 - - - true - - 0 - 1 - 0 - - 1 - - 0.1058824 - 0.1647059 - 0.2078432 - - 0 - 0 - false - false - 0 - SelectionOutline - null - null - null - null - - 0 - -1 - 0 - -1 - - null - 0 - false - null - - 1 - 2 - 1 - 2 - - 0 - 0 - - false 1 - true - - - false - - 0 - 0 - - - true - - 0 - 1 - 0 - - 0 - - 0.1058824 - 0.1647059 - 0.2078432 - - 0 - 0 - false - false - 0 - Outline - null - null - null - null - - 0 - 0 - 0.97 - 0 - - null - 0 - false - null - - 1 - 0 - 0.03 - 0 - - 0 - 0 - - true - 3 - true - - - - - false - - 0 - 0 - - - true - - 0 - 1 - 0 - - 0 - - 0.1058824 - 0.1647059 - 0.2078432 - - 0 - 0 - false - false - 0 - Outline - null - null - null - null - - 0.97 - 0 - 0 - 0 - - null - 0 - false - null - - 0.03 - 0 - 1 - 0 - - 0 - 0 - - true - 3 - true - - - - - false - - 0 - 0 - - - true - - 0 - 1 - 0 - - 0 - - 0.1058824 - 0.1647059 - 0.2078432 - - 0 - 0 - false - false - 0 - Outline - null - null - null - null - - 0 - 0 - 0 - 0 - - null - 0 - false - null - - 0.03 - 0 - 1 - 0 - - 0 - 0 - - true - 3 - true - - - - - false - - 0 - 0 - - - true - - 0 - 1 - 0 - - 0 - - 0.1058824 - 0.1647059 - 0.2078432 - - 0 - 0 - false - false - 0 - Outline - null - null - null - null - - 0 - 0 - 0 - 0 - - null - 0 - false - null - - 1 - 0 - 0.03 - 0 - - 0 - 0 - - true - 3 - true - - - + false @@ -440,15 +159,15 @@ true - 0.7058824 - 0.7058824 - 0.7058824 + 0.70588237 + 0.70588237 + 0.70588237 1 - 0.1058824 - 0.1647059 - 0.2078432 + 0.105882399 + 0.164705902 + 0.207843199 0 0 @@ -479,12 +198,11 @@ 0 0 - false - 3 - true + true + 1 - + false @@ -500,17 +218,15 @@ 1 - 0.1058824 - 0.1647059 - 0.2078432 + 0.105882399 + 0.164705902 + 0.207843199 0 0 false false - - - + 1 1 @@ -532,9 +248,9 @@ null null - 0.15 + 0.150000006 0 - 0.15 + 0.150000006 0 null @@ -543,9 +259,9 @@ false null - 0.7 + 0.699999988 0 - 0.7 + 0.699999988 0 0 @@ -568,11 +284,10 @@ 0 true - 4 - true + 1 - + true @@ -588,9 +303,9 @@ 1 - 0.1058824 - 0.1647059 - 0.2078432 + 0.105882399 + 0.164705902 + 0.207843199 0 0 @@ -605,9 +320,9 @@ null null - 0.1 + 0.100000001 0 - 0.475 + 0.474999994 0 null @@ -617,7 +332,7 @@ 2 0 - 0.17 + 0.170000002 0 0 @@ -631,19 +346,103 @@ true 100 - 0.4980392 - 0.4980392 - 0.4980392 + 0.498039186 + 0.498039186 + 0.498039186 0.5 - 0.2 + 0.200000003 0 true 0 1 true - 4 - true + 1 + + + + + false + + 0 + 0 + + + true + + 1 + 1 + 1 + + 1 + + 0.105882362 + 0.164705887 + 0.207843155 + + 0 + 0 + false + false + rbxassetid://4331165254 + + 1 + 1 + 1 + + + 0 + 0 + + + 0 + 0 + + 0 + 0 + SelectionOutline + null + null + null + null + + 0 + 0 + 0 + 0 + + null + 0 + 0 + false + null + + 1 + 0 + 1 + 0 + + 0 + + + 0 + 0 + + + 0 + 0 + + + 1 + + + 1 + 0 + 1 + 0 + + false + 2 diff --git a/UI/Backpack/Slots/init.meta.json b/UI/Backpack/Slots/init.meta.json new file mode 100644 index 0000000..6a7d067 --- /dev/null +++ b/UI/Backpack/Slots/init.meta.json @@ -0,0 +1,9 @@ +{ + "className": "Frame", + + "properties": + { + "BackgroundTransparency": 1, + "Size": [1, 0, 1, 0] + } +} \ No newline at end of file diff --git a/UI/Backpack/UIScale.model.json b/UI/Backpack/UIScale.model.json new file mode 100644 index 0000000..deaf5f1 --- /dev/null +++ b/UI/Backpack/UIScale.model.json @@ -0,0 +1,8 @@ +{ + "ClassName": "UIScale", + + "Properties": + { + "Scale": 0.1333 + } +} \ No newline at end of file diff --git a/UI/Backpack/init.meta.json b/UI/Backpack/init.meta.json index c7ba9a1..6b94d2b 100644 --- a/UI/Backpack/init.meta.json +++ b/UI/Backpack/init.meta.json @@ -1,3 +1,14 @@ { - "className": "Frame" + "className": "Frame", + + "properties": + { + "AnchorPoint": [0, 1], + + "BackgroundTransparency": 1, + "SizeConstraint": "RelativeYY", + + "Position": [0, 0, 1, 0], + "Size": [1, 0, 1, 0] + } } \ No newline at end of file diff --git a/UI/Chat/init.client.lua b/UI/Chat/Chat.client.lua similarity index 88% rename from UI/Chat/init.client.lua rename to UI/Chat/Chat.client.lua index 422089b..55e8ef1 100644 --- a/UI/Chat/init.client.lua +++ b/UI/Chat/Chat.client.lua @@ -8,25 +8,28 @@ local RunService = game:GetService("RunService") local TextService = game:GetService("TextService") local UserInputService = game:GetService("UserInputService") -local LinkedList = require(script:WaitForChild("LinkedList")) +local chat = script.Parent +local util = chat:WaitForChild("Utility") -local ui = script.Parent -local rootFrame = ui:WaitForChild("RootFrame") - -local chat = rootFrame:WaitForChild("Chat") local chatBar = chat:WaitForChild("ChatBar") local chatOutput = chat:WaitForChild("ChatOutput") local chatRemote = ReplicatedStorage:WaitForChild("ChatRemote") local focusBackdrop = chatBar:WaitForChild("FocusBackdrop") local mainBackdrop = chat:WaitForChild("MainBackdrop") -local messageTemplate = script:WaitForChild("MessageTemplate") +local messageTemplate = util:WaitForChild("MessageTemplate") -local hasCoreGateway, coreGateway = pcall(function () - local getCoreGateway = script:WaitForChild("GetCoreGateway") - return require(getCoreGateway) +local LinkedList = require(util:WaitForChild("LinkedList")) + +local success, RobloxChatMount = pcall(function () + local chatMount = util:WaitForChild("RobloxChatMount") + return require(chatMount) end) +if not success then + RobloxChatMount = nil +end + -------------------------------------------------------------------------------------------------------------------------------------- -- Player Colors -------------------------------------------------------------------------------------------------------------------------------------- @@ -53,7 +56,7 @@ local function computePlayerColor(player) local oddShift = (1 - (length % 2)) local value = 0 - for i = 1,length do + for i = 1, length do local char = pName:sub(i, i):byte() local rev = (length - i) + oddShift @@ -74,11 +77,14 @@ end local function beginChatting() focusBackdrop.Visible = true - + mainBackdrop.BackgroundColor3 = Color3.new(1, 1, 1) + if not chatBar:IsFocused() then chatBar.TextTransparency = 1 chatBar:CaptureFocus() + wait() + chatBar.Text = "" chatBar.TextTransparency = 0 end @@ -102,13 +108,14 @@ local function onChatFocusLost(enterPressed) chatRemote:FireServer(msg) - if hasCoreGateway then - coreGateway.ChatWindow.MessagePosted:Fire(msg) + if RobloxChatMount then + RobloxChatMount.ChatWindow.MessagePosted:Fire(msg) end end chatBar.Text = "" focusBackdrop.Visible = false + mainBackdrop.BackgroundColor3 = focusBackdrop.BackgroundColor3 end UserInputService.InputBegan:Connect(onInputBegan) diff --git a/UI/Chat/ChatBar.rbxmx b/UI/Chat/ChatBar.rbxmx new file mode 100644 index 0000000..27d2ce7 --- /dev/null +++ b/UI/Chat/ChatBar.rbxmx @@ -0,0 +1,141 @@ + + true + null + nil + + + true + + 1 + 0 + + + true + + 1 + 1 + 1 + + 1 + + 0.168627501 + 0.168627501 + 0.168627501 + + 0 + 0 + true + false + false + 4 + 0 + 1 + false + ChatBar + null + null + null + null + + 1 + 1 + 0.784313798 + + To chat click here or press the "/" key + + 1 + 0 + 1 + 0 + + null + 0 + true + null + true + + 1 + -3 + 0 + 15 + + 0 + + + + 0 + 0 + 0 + + true + false + 15 + + 0 + 0 + 0 + + 1 + 0 + 0 + false + 0 + 1 + true + 3 + + + + false + + 0 + 0 + + + true + + 0.250980407 + 0.250980407 + 0.250980407 + + 0 + + 0.105882399 + 0.164705902 + 0.207843199 + + 0 + 0 + false + false + 0 + FocusBackdrop + null + null + null + null + + 0 + -3 + 1 + 3 + + null + 0 + false + null + + 1 + 3 + 0 + 3 + + 0 + 0 + + false + 2 + + + + \ No newline at end of file diff --git a/UI/Chat/ChatOutput.rbxmx b/UI/Chat/ChatOutput.rbxmx new file mode 100644 index 0000000..d1bdb77 --- /dev/null +++ b/UI/Chat/ChatOutput.rbxmx @@ -0,0 +1,73 @@ + + true + null + nil + + + false + + 0 + 0 + + + true + + 1 + 1 + 1 + + 1 + + 0.105882399 + 0.164705902 + 0.207843199 + + 0 + 1 + true + false + 0 + ChatOutput + null + null + null + null + + 0 + 23 + 0 + 29 + + null + 0 + false + null + + 1 + 0 + 0 + 96 + + 0 + 0 + + true + 1 + + + + + 1 + 1 + Stream + + 0 + 0 + + 2 + + 2 + + + + \ No newline at end of file diff --git a/UI/SafeChat/NullSelectionImageObject.rbxmx b/UI/Chat/MainBackdrop.rbxmx similarity index 68% rename from UI/SafeChat/NullSelectionImageObject.rbxmx rename to UI/Chat/MainBackdrop.rbxmx index 6373a95..168b278 100644 --- a/UI/SafeChat/NullSelectionImageObject.rbxmx +++ b/UI/Chat/MainBackdrop.rbxmx @@ -1,5 +1,8 @@ - - + + true + null + nil + false @@ -9,22 +12,22 @@ true - 1 - 1 - 1 + 0.250980407 + 0.250980407 + 0.250980407 0 - 0.1058824 - 0.1647059 - 0.2078432 + 0.105882399 + 0.164705902 + 0.207843199 0 0 false false 0 - NullSelectionImageObject + MainBackdrop null null null @@ -32,7 +35,7 @@ 0 0 - 0 + 1 0 null @@ -40,17 +43,16 @@ false null - 0 + 1 0 0 - 0 + 20 0 0 true 1 - true \ No newline at end of file diff --git a/UI/Chat/LinkedList.lua b/UI/Chat/Utility/LinkedList.lua similarity index 100% rename from UI/Chat/LinkedList.lua rename to UI/Chat/Utility/LinkedList.lua diff --git a/UI/Chat/MessageTemplate.rbxmx b/UI/Chat/Utility/MessageTemplate.rbxmx similarity index 100% rename from UI/Chat/MessageTemplate.rbxmx rename to UI/Chat/Utility/MessageTemplate.rbxmx diff --git a/UI/Chat/GetCoreGateway.lua b/UI/Chat/Utility/RobloxChatMount.lua similarity index 97% rename from UI/Chat/GetCoreGateway.lua rename to UI/Chat/Utility/RobloxChatMount.lua index 96af2a6..d24a5d4 100644 --- a/UI/Chat/GetCoreGateway.lua +++ b/UI/Chat/Utility/RobloxChatMount.lua @@ -1,16 +1,20 @@ local ChatConnections = {} -local function AddObjects(bindableClass,targetName,...) +local function AddObjects(bindableClass, targetName, ...) local target = ChatConnections[targetName] + if not target then target = {} ChatConnections[targetName] = target end + local names = {...} + for _,name in pairs(names) do local signal = Instance.new(bindableClass) signal.Name = targetName .. "_" .. name signal.Parent = script + target[name] = signal end end @@ -75,11 +79,12 @@ local GuiService = game:GetService("GuiService") if not GuiService:IsTenFootInterface() then local tries = 0 local maxAttempts = 30 - + while (tries < maxAttempts) do local success,result = pcall(function () StarterGui:SetCore("CoreGuiChatConnections", ChatConnections) end) + if success then break else diff --git a/UI/Chat/init.meta.json b/UI/Chat/init.meta.json new file mode 100644 index 0000000..6a7d067 --- /dev/null +++ b/UI/Chat/init.meta.json @@ -0,0 +1,9 @@ +{ + "className": "Frame", + + "properties": + { + "BackgroundTransparency": 1, + "Size": [1, 0, 1, 0] + } +} \ No newline at end of file diff --git a/UI/ChatPadding.model.json b/UI/ChatPadding.model.json new file mode 100644 index 0000000..66b2533 --- /dev/null +++ b/UI/ChatPadding.model.json @@ -0,0 +1,12 @@ +{ + "ClassName": "UIPadding", + + "Properties": + { + "PaddingBottom": + { + "Type": "UDim", + "Value": [0, 20] + } + } +} \ No newline at end of file diff --git a/UI/ConsoleTweaks.client.lua b/UI/ConsoleTweaks.client.lua index be07b52..29a9c67 100644 --- a/UI/ConsoleTweaks.client.lua +++ b/UI/ConsoleTweaks.client.lua @@ -1,7 +1,7 @@ local UserInputService = game:GetService("UserInputService") local GuiService = game:GetService("GuiService") -local function addUIScale(obj,scale) +local function addUIScale(obj, scale) local uiScale = Instance.new("UIScale") uiScale.Scale = scale uiScale.Parent = obj @@ -21,6 +21,7 @@ if GuiService:IsTenFootInterface() then chat.Visible = false local chatPadding = gui:WaitForChild("ChatPadding", 1) + if chatPadding then chatPadding:Destroy() end diff --git a/UI/GameJoin.rbxmx b/UI/GameJoin.rbxmx new file mode 100644 index 0000000..5844903 --- /dev/null +++ b/UI/GameJoin.rbxmx @@ -0,0 +1,215 @@ + + true + null + nil + + + false + + 0.5 + 0.5 + + + true + + 0.70588237 + 0.70588237 + 0.70588237 + + 0.5 + + 1 + 1 + 1 + + 0 + 3 + false + false + 0 + GameJoin + null + null + null + null + + 0.5 + 0 + 0.5 + 0 + + null + 0 + false + null + + 0.600000024 + 0 + 1 + 0 + + 0 + 0 + + false + 1 + + + + false + + 0 + 0.5 + + + true + + 1 + 1 + 1 + + 1 + + 0.105882399 + 0.164705902 + 0.207843199 + + 0 + 1 + false + false + 9 + 0 + 1 + Message + null + null + null + null + + 0 + 0 + 0.5 + 0 + + null + 0 + false + null + + 1 + 0 + 0.125 + 0 + + 0 + + Connecting to server... + + 1 + 1 + 1 + + true + 14 + + 1 + 1 + 1 + + 0.75 + 0 + 0 + true + 2 + 1 + true + 1 + + + + + 3 + 0 + + 1 + UIAspectRatioConstraint + + + + + + false + + 0 + 0.5 + + + true + + 1 + 1 + 1 + + 1 + + 0.105882399 + 0.164705902 + 0.207843199 + + 0 + 1 + false + false + 9 + 0 + 1 + ExitOverride + null + null + null + null + + 0 + 0 + 0.5 + 0 + + null + 0 + false + null + + 1 + 0 + 0.25 + 0 + + 0 + + + + 1 + 1 + 1 + + true + 14 + + 1 + 1 + 1 + + 0.75 + 0 + 0 + true + 2 + 1 + false + 1 + + + + \ No newline at end of file diff --git a/UI/Health.client.lua b/UI/Health/Health.client.lua similarity index 57% rename from UI/Health.client.lua rename to UI/Health/Health.client.lua index bca252c..137a044 100644 --- a/UI/Health.client.lua +++ b/UI/Health/Health.client.lua @@ -1,14 +1,14 @@ local StarterGui = game:GetService("StarterGui") -StarterGui:SetCoreGuiEnabled("All",false) +StarterGui:SetCoreGuiEnabled("All", false) local health = script.Parent -local redBar = health:WaitForChild("RedBar") -local greenBar = redBar:WaitForChild("GreenBar") +local healthBar = health:WaitForChild("HealthBar") +local healthGauge = healthBar:WaitForChild("HealthGauge") local player = game.Players.LocalPlayer -local c = workspace.CurrentCamera +local camera = workspace.CurrentCamera -if c.ViewportSize.Y < 600 then +if camera.ViewportSize.Y < 600 then local scale = Instance.new("UIScale") scale.Scale = 0.6 scale.Parent = health @@ -18,11 +18,13 @@ local function onCharacterAdded(char) local humanoid = char:WaitForChild("Humanoid") local function updateHealth(health) - greenBar.Size = UDim2.new(1, 0, health / humanoid.MaxHealth, 0) + healthGauge.Size = UDim2.new(1, 0, health / humanoid.MaxHealth, 0) end updateHealth(humanoid.MaxHealth) humanoid.HealthChanged:Connect(updateHealth) + + health.Visible = true end if player.Character then diff --git a/UI/Health/HealthBar.model.json b/UI/Health/HealthBar.model.json new file mode 100644 index 0000000..a9c2a61 --- /dev/null +++ b/UI/Health/HealthBar.model.json @@ -0,0 +1,31 @@ +{ + "ClassName": "Frame", + + "Properties": + { + "BorderSizePixel": 0, + "AnchorPoint": [0.5, 0], + "BackgroundColor3": [1, 0, 0], + + "Position": [0.5, 0, 0, 0], + "Size": [0, 12, 0, 112] + }, + + "Children": + [ + { + "Name": "HealthGauge", + "ClassName": "Frame", + + "Properties": + { + "BorderSizePixel": 0, + "AnchorPoint": [0.5, 1], + "BackgroundColor3": [0.5058, 0.7725, 0.086], + + "Position": [0.5, 0, 1, 0], + "Size": [1, 0, 1, 0] + } + } + ] +} \ No newline at end of file diff --git a/UI/Health/HealthLabel.model.json b/UI/Health/HealthLabel.model.json new file mode 100644 index 0000000..8adb90d --- /dev/null +++ b/UI/Health/HealthLabel.model.json @@ -0,0 +1,21 @@ +{ + "ClassName": "TextLabel", + + "Properties": + { + "AnchorPoint": [0.5, 1], + "BackgroundTransparency": 1, + + "Font": "Cartoon", + "Text": "Health", + + "Position": [0.5, 0, 1, 0], + "Size": [1, 0, 0, 24], + + "TextScaled": true, + "TextColor3": [0, 0, 1], + + "TextStrokeColor3": [0, 0, 1], + "TextStrokeTransparency": 0.9 + } +} \ No newline at end of file diff --git a/UI/Health/init.meta.json b/UI/Health/init.meta.json new file mode 100644 index 0000000..78cdacb --- /dev/null +++ b/UI/Health/init.meta.json @@ -0,0 +1,14 @@ +{ + "className": "Frame", + + "properties": + { + "AnchorPoint": [1, 0.5], + "BackgroundTransparency": 1, + + "Position": [1, -31, 0.5, 0], + "Size": [0, 66, 0, 137], + + "Visible": false + } +} \ No newline at end of file diff --git a/UI/HelpWindow.rbxmx b/UI/HelpWindow.rbxmx new file mode 100644 index 0000000..f95ef58 --- /dev/null +++ b/UI/HelpWindow.rbxmx @@ -0,0 +1,432 @@ + + true + null + nil + + + true + + 0.5 + 0.5 + + + true + + 1 + 1 + 1 + + 1 + + 0.105882399 + 0.164705902 + 0.207843199 + + 0 + 1 + false + true + rbxassetid://1041546985 + + 1 + 1 + 1 + + + 0 + 0 + + + 0 + 0 + + 0 + 0 + HelpWindow + null + null + null + null + + 0.5 + 0 + 0.5 + 0 + + null + 0 + 1 + false + null + + 0.800000012 + 0 + 0.699999988 + 0 + + 0 + + + 4 + 30 + + + 304 + 130 + + + 1 + + + 1 + 0 + 1 + 0 + + false + 5 + + + + false + + 0 + 0 + + + true + + 1 + 1 + 1 + + 0 + + 0.105882399 + 0.164705902 + 0.207843199 + + 0 + 0 + false + false + rbxassetid://1041647615 + + 1 + 1 + 1 + + + 0 + 0 + + + 0 + 0 + + 0 + 0 + Help + null + null + null + null + + 0 + 4 + 0 + 31 + + null + 0 + 0 + false + null + + 1 + -8 + 1 + -36 + + 0 + + + 0 + 0 + + + 0 + 0 + + + 1 + + + 1 + 0 + 1 + 0 + + true + 1 + + + + 2.75 + 0 + + 0 + UIAspectRatioConstraint + + + + + + + false + + 0 + 0 + + + true + + 1 + 1 + 1 + + 1 + + 0.105882399 + 0.164705902 + 0.207843199 + + 0 + 1 + false + false + 2 + 0 + 1 + Title + null + null + null + null + + 0 + 7 + 0 + 2 + + null + 0 + false + null + + 0.899999976 + -10 + 0 + 30 + + 0 + + ROBLOX Help + + 0 + 0 + 0 + + false + 14 + + 0.494117677 + 0.494117677 + 0.494117677 + + 1 + 0 + 0 + false + 0 + 1 + true + 2 + + + + false + + 0 + 0 + + + true + + 1 + 1 + 1 + + 1 + + 0.105882399 + 0.164705902 + 0.207843199 + + 0 + 1 + false + false + 2 + 0 + 1 + Stroke + null + null + null + null + + 0 + -1 + 0 + -1 + + null + 0 + false + null + + 1 + 0 + 1 + 0 + + 0 + + ROBLOX Help + + 1 + 1 + 1 + + false + 14 + + 0.494117677 + 0.494117677 + 0.494117677 + + 0.600000024 + 0 + 0 + false + 0 + 1 + true + -1000 + + + + + + true + + 1 + 0 + + + true + true + + 1 + 1 + 1 + + 1 + + 0.105882399 + 0.164705902 + 0.207843199 + + 0 + 1 + false + false + + rbxassetid://1041651899 + + 1 + 1 + 1 + + + 0 + 0 + + + 0 + 0 + + 0 + 0 + true + Close + null + null + null + null + + 1 + -5 + 0 + 5 + + + null + 0 + 0 + true + false + null + + 0 + 22 + 0 + 22 + + 1 + + + 0 + 0 + + + 0 + 0 + + + 1 + 0 + + + 1 + 0 + 1 + 0 + + true + 1 + + + + + 2.5 + 0 + + 0 + UIAspectRatioConstraint + + + + + \ No newline at end of file diff --git a/Client/ClickToMove.client.lua b/UI/Mouse/ClickToMove.client.lua similarity index 94% rename from Client/ClickToMove.client.lua rename to UI/Mouse/ClickToMove.client.lua index 183f74b..5bd6bd4 100644 --- a/Client/ClickToMove.client.lua +++ b/UI/Mouse/ClickToMove.client.lua @@ -25,7 +25,7 @@ local DISK_OFFSET = CFrame.Angles(math.pi / 2,0,0) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- local player = game.Players.LocalPlayer -local character,humanoid +local character, humanoid local function onCharacterAdded(char) humanoid = char:WaitForChild("Humanoid") @@ -65,7 +65,7 @@ UserInputService.InputChanged:Connect(onInputChanged) local currentGoal, moveSignal local function findAngleBetweenXZVectors(vec2, vec1) - return math.atan2(vec1.X*vec2.Z-vec1.Z*vec2.X, vec1.X*vec2.X + vec1.Z*vec2.Z) + return math.atan2(vec1.X * vec2.Z - vec1.Z * vec2.X, vec1.X * vec2.X + vec1.Z * vec2.Z) end local function isFinite(num) @@ -73,23 +73,24 @@ local function isFinite(num) end local function rotateCameraTowardsGoal() - local c = workspace.CurrentCamera - if c then - local cf = c.CFrame - local focus = c.Focus + local camera = workspace.CurrentCamera + + if camera then + local cf = camera.CFrame + local focus = camera.Focus - local desiredAngle = CFrame.new(cf.p,currentGoal).lookVector - local currentAngle = cf.lookVector + local desiredAngle = CFrame.new(cf.Position, currentGoal).lookVector + local currentAngle = cf.LookVector - local angleBetween = findAngleBetweenXZVectors(desiredAngle,currentAngle) + local angleBetween = findAngleBetweenXZVectors(desiredAngle, currentAngle) if isFinite(angleBetween) then local abs = math.abs(angleBetween) local sign = math.sign(angleBetween) - local rotation = math.min(0.01,abs) + local rotation = math.min(0.01, abs) local cfLocal = focus:toObjectSpace(cf) - c.CFrame = focus * CFrame.Angles(0,-rotation*sign,0) * cfLocal + camera.CFrame = focus * CFrame.Angles(0, -rotation * ign, 0) * cfLocal end end end @@ -98,6 +99,7 @@ local function finishGoal() if currentGoal then currentGoal = nil end + if moveSignal then moveSignal:Disconnect() moveSignal = nil @@ -119,7 +121,7 @@ end ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- local mouse = player:GetMouse() -local mouseIcon = script.Parent +local mouseIcon = script.Parent mouse.TargetFilter = workspace.CurrentCamera local lastTarget @@ -153,11 +155,13 @@ local function isFirstPerson() return head.LocalTransparencyModifier == 1 end end + return false end local function canClickTarget() local target = mouse.Target + if target then if target ~= lastTarget then local canClick = false @@ -190,7 +194,7 @@ local function canRenderDisk(rendering) if humanoid then local movement = humanoid.MoveDirection if movement.Magnitude == 0 then - local pos = mouse.Hit.p + local pos = mouse.Hit.Position local dist = player:DistanceFromCharacter(pos) if dist < 32 then diff --git a/UI/Mouse/Mouse.client.lua b/UI/Mouse/Mouse.client.lua new file mode 100644 index 0000000..7d374f1 --- /dev/null +++ b/UI/Mouse/Mouse.client.lua @@ -0,0 +1,134 @@ +local UserInputService = game:GetService("UserInputService") +local RunService = game:GetService("RunService") +local GuiService = game:GetService("GuiService") +local Players = game:GetService("Players") + +----------------------------------------------------------------- + +local inGuiFocus = false +local inputQueue = {} + +local function checkGuiFocus() + inGuiFocus = (next(inputQueue) ~= nil) +end + +local function onInputChanged(input,gameProcessed) + if input.UserInputType == Enum.UserInputType.MouseMovement then + inputQueue[input] = gameProcessed or nil + checkGuiFocus() + end +end + +UserInputService.InputChanged:Connect(onInputChanged) + +----------------------------------------------------------------- + +local activated = false +local player = Players.LocalPlayer +local mouseGui = script.Parent + +local function onInputBegan(input,gameProcessed) + if mouseGui then + if input.UserInputType == Enum.UserInputType.Touch and not gameProcessed then + wait(.1) + if input.UserInputState == Enum.UserInputState.End then + activated = true + else + mouseGui.ImageTransparency = 1 + end + end + end +end + +UserInputService.InputBegan:Connect(onInputBegan) + +----------------------------------------------------------------- + +local GUN_WAIT_CURSOR = "rbxasset://textures/GunWaitCursor.png" +local GUN_CURSOR = "rbxasset://textures/GunCursor.png" +local IS_TOUCH = UserInputService.TouchEnabled + +local hasTool = false +UserInputService.MouseIconEnabled = false + +local canActivate = true + +if UserInputService.TouchEnabled then + local camera = workspace.CurrentCamera + local playerGui = player:WaitForChild("PlayerGui") + + local touchGui = playerGui:WaitForChild("TouchGui") + local touchFrame = touchGui:WaitForChild("TouchControlFrame") + + if camera.ViewportSize.Y < 600 then + touchFrame.Size = UDim2.new(0.85, 0, 0.8, 0) + else + touchFrame.Size = UDim2.new(0.9, 0, 0.9, 0) + end + + touchFrame.Position = UDim2.new(0.05, 0, 0, 0) +end + +local function updateMouse() + local char = player.Character + local override = false + local tool + + if char then + tool = char:FindFirstChildWhichIsA("Tool") + hasTool = (tool ~= nil) + + if tool then + if tool:FindFirstChild("IconOverride") then + if tool.IconOverride.Value ~= "" then + mouseGui.Image = tool.IconOverride.Value + else + mouseGui.Image = "rbxassetid://1000000" + end + elseif tool.Enabled then + mouseGui.Image = GUN_CURSOR + + if IS_TOUCH then + canActivate = true + mouseGui.ImageTransparency = 1 + end + else + mouseGui.Image = GUN_WAIT_CURSOR + end + end + else + hasTool = false + end + + if inGuiFocus then + mouseGui.Image = "rbxassetid://1000000" + end + + local pos = UserInputService:GetMouseLocation() + local upos = UDim2.new(0, pos.X, 0, pos.Y) + + if IS_TOUCH then + mouseGui.Visible = hasTool + + if hasTool then + if activated and mouseGui.Image == GUN_WAIT_CURSOR then + if canActivate then + canActivate = false + mouseGui.Position = upos + mouseGui.ImageTransparency = -1 + end + activated = false + else + mouseGui.ImageTransparency = math.min(1, mouseGui.ImageTransparency + 0.01) + end + end + else + mouseGui.Position = upos + end + + if UserInputService.MouseIconEnabled then + UserInputService.MouseIconEnabled = false + end +end + +RunService:BindToRenderStep("UpdateMouse", 1000, updateMouse) \ No newline at end of file diff --git a/UI/Mouse/init.meta.json b/UI/Mouse/init.meta.json new file mode 100644 index 0000000..c486600 --- /dev/null +++ b/UI/Mouse/init.meta.json @@ -0,0 +1,15 @@ +{ + "className": "ImageLabel", + + "properties": + { + "Size": [0, 80, 0, 80], + "AnchorPoint": [0.5, 0.5], + + "BackgroundTransparency": 1, + "Position": [0.5, 0, 0.5, 0], + + "Image": "rbxassetid://334630296", + "ZIndex": 100 + } +} \ No newline at end of file diff --git a/UI/PlayerList/Backdrop.rbxmx b/UI/PlayerList/Backdrop.rbxmx new file mode 100644 index 0000000..79784de --- /dev/null +++ b/UI/PlayerList/Backdrop.rbxmx @@ -0,0 +1,58 @@ + + true + null + nil + + + false + + 1 + 0 + + + true + + 0.600000024 + 0.600000024 + 0.600000024 + + 0.400000006 + + 0.105882362 + 0.164705887 + 0.207843155 + + 0 + 0 + false + false + 0 + Backdrop + null + null + null + null + + 1 + -10 + 0 + 10 + + null + 0 + false + null + + 0 + 10 + 0 + 10 + + 0 + 0 + + true + 1 + + + \ No newline at end of file diff --git a/UI/PlayerList/Container.rbxmx b/UI/PlayerList/Container.rbxmx new file mode 100644 index 0000000..0fdb956 --- /dev/null +++ b/UI/PlayerList/Container.rbxmx @@ -0,0 +1,68 @@ + + true + null + nil + + + false + + 0 + 0 + + + true + + 0 + 0 + 0 + + 1 + + 0.105882362 + 0.164705887 + 0.207843155 + + 0 + 0 + false + false + 0 + Container + null + null + null + null + + 1 + -10 + 0 + 10 + + null + 0 + false + null + + 0.165000007 + 0 + 1 + 0 + + 0 + 0 + + true + 1 + + + + 3 + 0 + + 0 + AspectRatio + + + + + \ No newline at end of file diff --git a/UI/PlayerList/init.client.lua b/UI/PlayerList/PlayerList.client.lua similarity index 97% rename from UI/PlayerList/init.client.lua rename to UI/PlayerList/PlayerList.client.lua index e3685ce..2df7e97 100644 --- a/UI/PlayerList/init.client.lua +++ b/UI/PlayerList/PlayerList.client.lua @@ -24,11 +24,13 @@ local statNames = {} local inTeamMode = false -local basePlayerLbl = script:WaitForChild("BasePlayerLbl") -local baseGroup = script:WaitForChild("BaseGroup") -local baseStat = script:WaitForChild("BaseStat") - local playerList = script.Parent +local templates = playerList:WaitForChild("Templates") + +local basePlayerLbl = templates:WaitForChild("BasePlayerLbl") +local baseGroup = templates:WaitForChild("BaseGroup") +local baseStat = templates:WaitForChild("BaseStat") + local backdrop = playerList:WaitForChild("Backdrop") local container = playerList:WaitForChild("Container") @@ -67,12 +69,14 @@ local PLAYER_COLORS = local function computePlayerColor(player) local pName = player.Name local length = #pName + local oddShift = (1 - (length % 2)) local value = 0 for i = 1,length do local char = pName:sub(i,i):byte() local rev = (length - i) + oddShift + if (rev % 4) >= 2 then value = value - char else @@ -246,10 +250,12 @@ local function onStatRemoved(stat,statName) if stat.ClassName == "IntValue" then local statName = statName or stat.Name local playerState = getPlayerStateFromStat(stat) + if playerState and playerState.Stats[statName] then playerState.Stats[statName]:Destroy() playerState.Stats[statName] = nil end + decrementStat(statName) refreshTeamStats() end @@ -259,6 +265,7 @@ local function onStatAdded(stat) if stat.ClassName == "IntValue" then local statName = stat.Name local playerState = getPlayerStateFromStat(stat) + if playerState then local changeSignal @@ -289,6 +296,7 @@ local function onStatAdded(stat) changeSignal:Disconnect() changeSignal = nil end + nameSignal:Disconnect() nameSignal = nil @@ -310,11 +318,14 @@ local function onPlayerChildAdded(leaderstats) if leaderstats.Name == "leaderstats" then local player = leaderstats.Parent local playerState = playerStates[player] + if playerState and not playerState.leaderstats then playerState.leaderstats = leaderstats + for _,stat in pairs(leaderstats:GetChildren()) do onStatAdded(stat) end + leaderstats.ChildAdded:Connect(onStatAdded) leaderstats.ChildRemoved:Connect(onStatRemoved) end @@ -326,6 +337,7 @@ local function onPlayerChildRemoved(child) for _,stat in pairs(child:GetChildren()) do onStatRemoved(stat) end + for player,playerState in pairs(playerStates) do if playerState.leaderstats == child then playerState.leaderstats = nil @@ -351,12 +363,14 @@ local function onUpdateStatLayout() for i,statName in pairs(statNames) do local statLbl = statBin:FindFirstChild(statName) + if not statLbl then statLbl = baseStat:Clone() statLbl.Name = statName statLbl.Text = statName statLbl.Parent = statBin end + updateStatLbl(statLbl,i) end @@ -370,6 +384,7 @@ local function onUpdateStatLayout() for i,statName in pairs(statNames) do local statLbl = playerState.Stats[statName] + if statLbl then if player.Team then statLbl.TextColor = player.Team.TeamColor @@ -417,6 +432,7 @@ local function onPlayerAdded(player) playerState.Player = player playerState.Label = lbl playerState.Stats = {} + playerStates[player] = playerState for _,child in pairs(player:GetChildren()) do @@ -457,14 +473,17 @@ Players.PlayerRemoving:Connect(onPlayerRemoved) local function neutralizePlayer(player) local playerState = playerStates[player] + if playerState then local playerLbl = playerState.Label playerLbl.PlayerName.Text = player.Name playerLbl.PlayerName.TextColor3 = computePlayerColor(player) - playerLbl.PlayerName.Position = UDim2.new(0,0,0,0) + playerLbl.PlayerName.Position = UDim2.new(0, 0, 0, 0) + for stat,statLbl in pairs(playerState.Stats) do statLbl.TextColor3 = Color3.new(1,1,1) end + playerLbl.Visible = (not isTeamMode) playerLbl.Parent = coreGroup end @@ -473,17 +492,21 @@ end local function onPlayerAddedToTeam(player) local team = player.Team local group = teamGroups[team] + if group then local playerState = playerStates[player] if playerState then local playerLbl = playerState.Label playerLbl.PlayerName.TextColor = team.TeamColor - playerLbl.PlayerName.Position = UDim2.new(0,4,0,0) - for stat,statLbl in pairs(playerState.Stats) do + playerLbl.PlayerName.Position = UDim2.new(0, 4, 0, 0) + + for stat, statLbl in pairs(playerState.Stats) do statLbl.TextColor = team.TeamColor end + playerLbl.Parent = group playerLbl.Visible = true + eUpdateStatLayout:Fire() refreshTeamStats() end @@ -499,18 +522,22 @@ end local function onUpdateTeamTotal(team) local teamGroup = teamGroups[team] + if teamGroup then local teamStats = teamGroup.Header.Stats local totals = {} for i,statName in ipairs(statNames) do local total = totals[i] + if not total then total = { Name = statName, Value = 0 } totals[i] = total end + for _,player in pairs(team:GetPlayers()) do local playerState = playerStates[player] + if playerState then local leaderstats = playerState.leaderstats if leaderstats then @@ -528,6 +555,7 @@ local function onUpdateTeamTotal(team) for i,statRecord in ipairs(totals) do local statName = statRecord.Name local statLbl = teamStats:FindFirstChild(statName) + if not statLbl then statLbl = baseStat:Clone() statLbl.Name = statName @@ -535,6 +563,7 @@ local function onUpdateTeamTotal(team) statLbl.TextStrokeTransparency = 0.5 statLbl.Parent = teamStats end + statLbl.Text = statRecord.Value updateStatLbl(statLbl,i) end @@ -595,10 +624,13 @@ local function onTeamRemoved(team) neutralizePlayer(player) end end + teamGroups[team]:Destroy() teamGroups[team] = nil + eUpdateStatLayout:Fire() end + if #Teams:GetTeams() == 0 then isTeamMode = false for _,player in pairs(Players:GetPlayers()) do @@ -609,6 +641,7 @@ end local function onPlayerTeamChange(player) local team = player.Team + if team then onPlayerAddedToTeam(player) else @@ -626,6 +659,7 @@ end Teams.ChildAdded:Connect(onTeamAdded) Teams.ChildRemoved:Connect(onTeamRemoved) + updateTeamTotal:Connect(onUpdateTeamTotal) playerTeamChanged:Connect(onPlayerTeamChange) diff --git a/UI/PlayerList/BaseGroup.rbxmx b/UI/PlayerList/Templates/BaseGroup.rbxmx similarity index 100% rename from UI/PlayerList/BaseGroup.rbxmx rename to UI/PlayerList/Templates/BaseGroup.rbxmx diff --git a/UI/PlayerList/BasePlayerLbl.rbxmx b/UI/PlayerList/Templates/BasePlayerLbl.rbxmx similarity index 100% rename from UI/PlayerList/BasePlayerLbl.rbxmx rename to UI/PlayerList/Templates/BasePlayerLbl.rbxmx diff --git a/UI/PlayerList/BaseStat.rbxmx b/UI/PlayerList/Templates/BaseStat.rbxmx similarity index 100% rename from UI/PlayerList/BaseStat.rbxmx rename to UI/PlayerList/Templates/BaseStat.rbxmx diff --git a/UI/PlayerList/Templates/init.meta.json b/UI/PlayerList/Templates/init.meta.json new file mode 100644 index 0000000..bcf157e --- /dev/null +++ b/UI/PlayerList/Templates/init.meta.json @@ -0,0 +1,8 @@ +{ + "className": "ScreenGui", + + "properties": + { + "Enabled": false + } +} \ No newline at end of file diff --git a/UI/PlayerList/init.meta.json b/UI/PlayerList/init.meta.json new file mode 100644 index 0000000..95e7d87 --- /dev/null +++ b/UI/PlayerList/init.meta.json @@ -0,0 +1,9 @@ +{ + "className": "Frame", + + "properties": + { + "BackgroundTransparency": 1, + "Size": [1, 0, 1, 0] + } +} \ No newline at end of file diff --git a/UI/SafeChat/Click.model.json b/UI/SafeChat/Click.model.json new file mode 100644 index 0000000..d2c28b1 --- /dev/null +++ b/UI/SafeChat/Click.model.json @@ -0,0 +1,8 @@ +{ + "ClassName": "Sound", + + "Properties": + { + "SoundId": "rbxasset://sounds/switch.mp3" + } +} \ No newline at end of file diff --git a/UI/SafeChat/Click.rbxmx b/UI/SafeChat/Click.rbxmx deleted file mode 100644 index 66db075..0000000 --- a/UI/SafeChat/Click.rbxmx +++ /dev/null @@ -1,24 +0,0 @@ - - - - - 10 - false - Click - false - 1 - false - 0 - null - - rbxasset://sounds/switch.mp3 - - - 0 - 0.5 - 10000 - 10 - true - - - \ No newline at end of file diff --git a/UI/SafeChat/Hint.model.json b/UI/SafeChat/Hint.model.json new file mode 100644 index 0000000..9f604bf --- /dev/null +++ b/UI/SafeChat/Hint.model.json @@ -0,0 +1,15 @@ +{ + "ClassName": "ImageLabel", + + "Properties": + { + "AnchorPoint": [0.5, 0.75], + "BackgroundTransparency": 1, + + "Position": [1, 5, 0, 0], + "Size": [0.75, 0, 0.75, 0], + + "Image": "rbxasset://textures/ui/Settings/Help/XButtonDark@2x.png", + "Visible": false + } +} \ No newline at end of file diff --git a/UI/SafeChat/init.client.lua b/UI/SafeChat/SafeChat.client.lua similarity index 91% rename from UI/SafeChat/init.client.lua rename to UI/SafeChat/SafeChat.client.lua index 08aac35..9f1d290 100644 --- a/UI/SafeChat/init.client.lua +++ b/UI/SafeChat/SafeChat.client.lua @@ -4,8 +4,9 @@ local GuiService = game:GetService("GuiService") local c = workspace.CurrentCamera local resUpdate = c:GetPropertyChangedSignal("ViewportSize") + local safeChat = script.Parent -local click = script:WaitForChild("Click") +local click = safeChat:WaitForChild("Click") local IMG_CHAT = "rbxassetid://991182833" local IMG_CHAT_DN = "rbxassetid://991182832" @@ -14,7 +15,7 @@ local IMG_CHAT_OVR = "rbxassetid://991182834" ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- Fetch Tree Data -local mSafeChatTree = ReplicatedStorage:WaitForChild("SafeChatTree") +local mSafeChatTree = ReplicatedStorage:WaitForChild("SafeChat") local safeChatTree = require(mSafeChatTree) ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- @@ -36,8 +37,11 @@ resUpdate:Connect(onResolutionUpdate) -- Safe Chat Tree local chatRemote = ReplicatedStorage:WaitForChild("ChatRemote") -local tempBranch = script:WaitForChild("TempBranch") -local tempButton = script:WaitForChild("TempButton") +local templates = safeChat:WaitForChild("Templates") + +local tempBranch = templates:WaitForChild("TempBranch") +local tempButton = templates:WaitForChild("TempButton") + local isActivated = false local rootTree @@ -47,6 +51,7 @@ local function recursivelyDeactivateTree(obj) elseif obj:IsA("TextButton") then obj.BackgroundColor3 = Color3.new(1,1,1) end + for _,v in pairs(obj:GetChildren()) do recursivelyDeactivateTree(v) end @@ -69,7 +74,7 @@ local function activateRootTree() safeChat.Image = IMG_CHAT_DN if UserInputService:GetLastInputType() == Enum.UserInputType.Gamepad1 then - GuiService:AddSelectionParent("SafechatNav",safeChat) + GuiService:AddSelectionParent("SafechatNav", safeChat) GuiService.SelectedObject = safeChat end end @@ -80,13 +85,16 @@ local function assembleTree(tree) local currentBranch - for i,branch in ipairs(tree.Branches) do + for i, branch in ipairs(tree.Branches) do local label = branch.Label local branches = branch.Branches + local button = tempButton:Clone() button.Name = label button.Text = label button.LayoutOrder = i + button.Visible = true + local branchFrame = assembleTree(branch) branchFrame.Parent = button button.Parent = treeFrame @@ -95,6 +103,7 @@ local function assembleTree(tree) if currentBranch then recursivelyDeactivateTree(currentBranch) end + currentBranch = button button.BackgroundColor3 = Color3.new(0.7,0.7,0.7) branchFrame.Visible = true @@ -102,16 +111,18 @@ local function assembleTree(tree) local function onActivate() local submit = true + if UserInputService.TouchEnabled then if not branchFrame.Visible and #branchFrame:GetChildren() > 1 then branchFrame.Visible = true submit = false end end + if submit then + click:Play() deactivateRootTree() chatRemote:FireServer(label) - click:Play() end end @@ -171,8 +182,9 @@ do safeChat.MouseEnter:Connect(onMouseEnter) safeChat.MouseLeave:Connect(onMouseLeave) - safeChat.MouseButton1Down:Connect(onMouseDown) + safeChat.MouseButton1Up:Connect(onMouseUp) + safeChat.MouseButton1Down:Connect(onMouseDown) UserInputService.InputBegan:Connect(onInputBegan) end @@ -181,7 +193,7 @@ end -- Gamepad Stuff ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -local gamepadHint = safeChat:WaitForChild("GamepadHint") +local gamepadHint = safeChat:WaitForChild("Hint") if GuiService:IsTenFootInterface() then gamepadHint.Visible = true diff --git a/UI/SafeChat/TempBranch.rbxmx b/UI/SafeChat/Templates/TempBranch.rbxmx similarity index 100% rename from UI/SafeChat/TempBranch.rbxmx rename to UI/SafeChat/Templates/TempBranch.rbxmx diff --git a/UI/SafeChat/TempButton.rbxmx b/UI/SafeChat/Templates/TempButton.rbxmx similarity index 98% rename from UI/SafeChat/TempButton.rbxmx rename to UI/SafeChat/Templates/TempButton.rbxmx index 5346add..07182ae 100644 --- a/UI/SafeChat/TempButton.rbxmx +++ b/UI/SafeChat/Templates/TempButton.rbxmx @@ -72,7 +72,7 @@ false 2 1 - true + false 2 true diff --git a/UI/SafeChat/init.meta.json b/UI/SafeChat/init.meta.json new file mode 100644 index 0000000..882d8fd --- /dev/null +++ b/UI/SafeChat/init.meta.json @@ -0,0 +1,14 @@ +{ + "className": "ImageButton", + + "properties": + { + "AnchorPoint": [0, 1], + "BackgroundTransparency": 1, + + "Position": [0, 22, 0.75, 0], + "Size": [0, 32, 0, 30], + + "Image": "rbxassetid://991182833" + } +} \ No newline at end of file diff --git a/UI/Topbar/ButtonLayout.model.json b/UI/Topbar/ButtonLayout.model.json new file mode 100644 index 0000000..2467784 --- /dev/null +++ b/UI/Topbar/ButtonLayout.model.json @@ -0,0 +1,9 @@ +{ + "ClassName": "UIListLayout", + + "Properties": + { + "FillDirection": "Horizontal", + "SortOrder": "LayoutOrder" + } +} \ No newline at end of file diff --git a/UI/Topbar/ButtonScale.model.json b/UI/Topbar/ButtonScale.model.json new file mode 100644 index 0000000..e7e64ff --- /dev/null +++ b/UI/Topbar/ButtonScale.model.json @@ -0,0 +1,7 @@ +{ + "ClassName": "UIScale", + "Properties": + { + "Scale": 1.44 + } +} \ No newline at end of file diff --git a/UI/Topbar/Topbar.client.lua b/UI/Topbar/Topbar.client.lua new file mode 100644 index 0000000..b5bff59 --- /dev/null +++ b/UI/Topbar/Topbar.client.lua @@ -0,0 +1,85 @@ +local topbar = script.Parent + +local buttons = +{ + Tools = + { + Label = "Tools"; + Enabled = false; + Order = 1; + }; + + Insert = + { + Label = "Insert"; + Enabled = false; + Order = 2; + }; + + Fullscreen = + { + Label = "Fullscreen"; + Enabled = true; + Order = 3; + }; + + Help = + { + Label = "Help..."; + Enabled = true; + Order = 4; + }; + + Exit = + { + Label = " Exit"; + Enabled = true; + Order = 5; + } +} + +local BTN_COLOR = Color3.fromRGB(177, 177, 177) +local TEXT_ACTIVE = Color3.fromRGB(77, 77, 77) +local TEXT_INACTIVE = Color3.fromRGB(156, 156, 156) + +for name, data in pairs(buttons) do + local button = Instance.new("TextButton") + button.Name = name + button.Active = data.Enabled + button.LayoutOrder = data.Order + button.Text = " " .. data.Label + + button.Font = "Cartoon" + button.AutoButtonColor = false + + button.BorderSizePixel = 0 + button.Size = UDim2.new(1, 0, 1, 0) + + button.BackgroundColor3 = BTN_COLOR; + button.BackgroundTransparency = 0.5; + + button.TextSize = 14 + button.TextXAlignment = "Left" + + button.TextTransparency = 0.3; + button.TextStrokeTransparency = 0.9; + + local textColor = (data.Enabled and TEXT_ACTIVE or TEXT_INACTIVE) + button.TextStrokeColor3 = textColor + button.TextColor3 = textColor + + if data.Enabled then + local function onMouseEnter() + button.BackgroundTransparency = 0 + end + + local function onMouseLeave() + button.BackgroundTransparency = 0.5 + end + + button.MouseEnter:Connect(onMouseEnter) + button.MouseLeave:Connect(onMouseLeave) + end + + button.Parent = topbar +end \ No newline at end of file diff --git a/UI/Topbar/init.meta.json b/UI/Topbar/init.meta.json new file mode 100644 index 0000000..251e87b --- /dev/null +++ b/UI/Topbar/init.meta.json @@ -0,0 +1,10 @@ +{ + "className": "Frame", + + "properties": + { + "BackgroundTransparency": 1, + "Position": [0, 80, 0, 0], + "Size": [0, 100, 0, 20] + } +} \ No newline at end of file diff --git a/UI/ZoomControls/FirstPersonIndicator.rbxmx b/UI/ZoomControls/FirstPersonIndicator.rbxmx new file mode 100644 index 0000000..ba15c36 --- /dev/null +++ b/UI/ZoomControls/FirstPersonIndicator.rbxmx @@ -0,0 +1,90 @@ + + true + null + nil + + + false + + 1 + 0 + + + true + + 1 + 1 + 1 + + 1 + + 0.105882362 + 0.164705887 + 0.207843155 + + 0 + 1 + false + false + rbxassetid://598702035 + + 1 + 1 + 1 + + + 0 + 0 + + + 0 + 0 + + 0 + 0 + FirstPersonIndicator + null + null + null + null + + 1 + 0 + 0 + -97 + + null + 0 + 0 + false + null + + 0 + 168 + 0 + 42 + + 0 + + + 0 + 0 + + + 0 + 0 + + + 1 + + + 1 + 0 + 1 + 0 + + false + 2 + + + \ No newline at end of file diff --git a/UI/ZoomControls/RotateDown.rbxmx b/UI/ZoomControls/RotateDown.rbxmx new file mode 100644 index 0000000..b74f66c --- /dev/null +++ b/UI/ZoomControls/RotateDown.rbxmx @@ -0,0 +1,96 @@ + + true + null + nil + + + true + + 0 + 0 + + + true + true + + 1 + 1 + 1 + + 1 + + 0.105882399 + 0.164705902 + 0.207843199 + + 0 + 0 + false + false + + rbxassetid://598662248 + + 1 + 1 + 1 + + + 0 + 0 + + + 0 + 0 + + 0 + 0 + false + RotateDown + null + null + null + null + + 0 + 0 + 0 + 35 + + + null + -180 + 0 + true + false + null + + 0 + 35 + 0 + 35 + + 0 + + + 0 + 0 + + + 0 + 0 + + + 1 + 0 + + + 1 + 0 + 1 + 0 + + true + 2 + + + \ No newline at end of file diff --git a/UI/ZoomControls/RotateUp.rbxmx b/UI/ZoomControls/RotateUp.rbxmx new file mode 100644 index 0000000..4d49a8c --- /dev/null +++ b/UI/ZoomControls/RotateUp.rbxmx @@ -0,0 +1,96 @@ + + true + null + nil + + + true + + 0 + 0 + + + true + true + + 1 + 1 + 1 + + 1 + + 0.105882399 + 0.164705902 + 0.207843199 + + 0 + 0 + false + false + + rbxassetid://598662248 + + 1 + 1 + 1 + + + 0 + 0 + + + 0 + 0 + + 0 + 0 + false + RotateUp + null + null + null + null + + 0 + 0 + 0 + 0 + + + null + 0 + 0 + true + false + null + + 0 + 35 + 0 + 35 + + 0 + + + 0 + 0 + + + 0 + 0 + + + 1 + 0 + + + 1 + 0 + 1 + 0 + + true + 2 + + + \ No newline at end of file diff --git a/UI/ZoomControls.client.lua b/UI/ZoomControls/ZoomControls.client.lua similarity index 91% rename from UI/ZoomControls.client.lua rename to UI/ZoomControls/ZoomControls.client.lua index 36fcd84..01ef8f3 100644 --- a/UI/ZoomControls.client.lua +++ b/UI/ZoomControls/ZoomControls.client.lua @@ -16,9 +16,9 @@ local zoomIn = self:WaitForChild("ZoomIn") local zoomLock = zoomIn:WaitForChild("Lock") local firstPersonIndicator = self:WaitForChild("FirstPersonIndicator") -local yellow = Color3.new(1,1,0) -local cyan = Color3.new(0,1,1) -local white = Color3.new(1,1,1) +local yellow = Color3.new(1, 1, 0) +local white = Color3.new(1, 1, 1) +local cyan = Color3.new(0, 1, 1) local c = workspace.CurrentCamera local currentlyDown @@ -32,8 +32,10 @@ end local function setupButton(btn) local isDown = false local inBounds = false + local lock = btn:FindFirstChild("Lock") local mouse = player:GetMouse() + btn.MouseEnter:connect(function () if (lock == nil or not lock.Visible) then if (currentlyDown == nil or currentlyDown == btn) then @@ -46,6 +48,7 @@ local function setupButton(btn) end end end) + btn.MouseLeave:connect(function () if (lock == nil or not lock.Visible) then inBounds = false @@ -56,6 +59,7 @@ local function setupButton(btn) end end end) + btn.MouseButton1Down:connect(function () if (lock == nil or not lock.Visible) then isDown = true @@ -63,6 +67,7 @@ local function setupButton(btn) btn.ImageColor3 = yellow end end) + btn.MouseButton1Click:connect(function () if (lock == nil or not lock.Visible) then isDown = false @@ -74,30 +79,36 @@ local function setupButton(btn) end end end) - mouse.Button1Up:connect(function () + + mouse.Button1Up:Connect(function () if (lock == nil or not lock.Visible) then if isDown then isDown = false currentlyDown = nil + if inBounds then inBounds = false passCameraEvent:Fire(btn.Name) end end end + btn.ImageColor3 = white end) + if lock then - lock.Changed:connect(function () + lock.Changed:Connect(function () if lock.Visible then btn.ImageColor3 = white isDown = false + if currentlyDown == btn then currentlyDown = nil end end end) end + if IS_TOUCH then btn.Modal = true end diff --git a/UI/ZoomControls/ZoomIn.rbxmx b/UI/ZoomControls/ZoomIn.rbxmx new file mode 100644 index 0000000..c05c2da --- /dev/null +++ b/UI/ZoomControls/ZoomIn.rbxmx @@ -0,0 +1,149 @@ + + true + null + nil + + + true + + 0 + 0 + + + true + true + + 1 + 1 + 1 + + 1 + + 0.105882399 + 0.164705902 + 0.207843199 + + 0 + 0 + false + false + + rbxassetid://598663795 + + 1 + 1 + 1 + + + 0 + 0 + + + 0 + 0 + + 0 + 0 + false + ZoomIn + null + null + null + null + + 0 + 35 + 0 + 0 + + + null + 0 + 0 + true + false + null + + 0 + 35 + 0 + 35 + + 0 + + + 0 + 0 + + + 0 + 0 + + + 1 + 0 + + + 1 + 0 + 1 + 0 + + true + 2 + + + + false + + 0 + 0 + + + true + + 1 + 1 + 1 + + 0.5 + + 0.105882399 + 0.164705902 + 0.207843199 + + 0 + 0 + false + false + 0 + Lock + null + null + null + null + + 0 + 0 + 0 + 0 + + null + 0 + false + null + + 0 + 35 + 0 + 35 + + 0 + 0 + + false + 3 + + + + \ No newline at end of file diff --git a/UI/ZoomControls/ZoomOut.rbxmx b/UI/ZoomControls/ZoomOut.rbxmx new file mode 100644 index 0000000..0436a02 --- /dev/null +++ b/UI/ZoomControls/ZoomOut.rbxmx @@ -0,0 +1,149 @@ + + true + null + nil + + + true + + 0 + 0 + + + true + true + + 1 + 1 + 1 + + 1 + + 0.105882399 + 0.164705902 + 0.207843199 + + 0 + 0 + false + false + + rbxassetid://598665130 + + 1 + 1 + 1 + + + 0 + 0 + + + 0 + 0 + + 0 + 0 + false + ZoomOut + null + null + null + null + + 0 + 35 + 0 + 35 + + + null + 0 + 0 + true + false + null + + 0 + 35 + 0 + 35 + + 0 + + + 0 + 0 + + + 0 + 0 + + + 1 + 0 + + + 1 + 0 + 1 + 0 + + true + 2 + + + + false + + 0 + 0 + + + true + + 1 + 1 + 1 + + 0.5 + + 0.105882399 + 0.164705902 + 0.207843199 + + 0 + 0 + false + false + 0 + Lock + null + null + null + null + + 0 + 0 + 0 + 0 + + null + 0 + false + null + + 0 + 35 + 0 + 35 + + 0 + 0 + + false + 3 + + + + \ No newline at end of file diff --git a/UI/ZoomControls/init.meta.json b/UI/ZoomControls/init.meta.json new file mode 100644 index 0000000..a519c2a --- /dev/null +++ b/UI/ZoomControls/init.meta.json @@ -0,0 +1,12 @@ +{ + "className": "Frame", + + "properties": + { + "AnchorPoint": [1, 1], + "BackgroundTransparency": 1, + + "Size": [0, 70, 0, 70], + "Position": [1, 0, 1, 0] + } +} \ No newline at end of file diff --git a/UI/init.meta.json b/UI/init.meta.json index b703205..d3fd97d 100644 --- a/UI/init.meta.json +++ b/UI/init.meta.json @@ -1,9 +1,10 @@ { - "className": "Frame", + "className": "ScreenGui", "properties": { - "BackgroundTransparency": 1, - "Size": [1, 0, 1, 0] + "ResetOnSpawn": false, + "IgnoreGuiInset": true, + "ZIndexBehavior": "Sibling" } } \ No newline at end of file diff --git a/default.project.json b/default.project.json index 525ef9e..6f25745 100644 --- a/default.project.json +++ b/default.project.json @@ -1,13 +1,13 @@ { - "name": "MainModule", + "name": "Super Nostalgia Zone", - "tree": + "tree": { - "$path": "init.lua", + "$className": "DataModel", "ReplicatedFirst": { - "$className": "Folder", + "$className": "ReplicatedFirst", "JoinScript": { @@ -17,24 +17,16 @@ "ReplicatedStorage": { - "$className": "Folder", - - "SafeChatTree": - { - "$path": "Resources/SafeChat" - } + "$className": "ReplicatedStorage", + "$path": "Shared" }, "ServerStorage": { - "$className": "Folder", - - "CoreBevelCache": - { - "$path": "Resources/BevelCache" - }, - - "StandardTools": + "$className": "ServerStorage", + "$path": "Server/Resources", + + "Tools": { "$path": "Tools" } @@ -42,28 +34,54 @@ "StarterGui": { - "$className": "Folder", + "$className": "StarterGui", "UI": { - "$className": "ScreenGui", "$path": "UI" + }, + + "DEPRECATED_UI": + { + "$className": "ScreenGui", + + "RootFrame": + { + "$path": "Resources/RootFrame.rbxmx" + } } }, - "ServerScriptService": + "ServerScriptService": { - "$path": "Server" + "$className": "ServerScriptService", + "$path": "Server/Scripts" }, - "StarterPlayerScripts": + "StarterPlayer": { - "$path": "Client" - }, - - "StarterCharacterScripts": - { - "$path": "Character" + "$className": "StarterPlayer", + + "$properties": + { + + "DevComputerMovementMode": "KeyboardMouse", + "DevTouchCameraMovementMode": "Classic", + "LoadCharacterAppearance": false, + "GameSettingsAvatar": "R6" + }, + + "StarterCharacterScripts": + { + "$className": "StarterCharacterScripts", + "$path": "Character" + }, + + "StarterPlayerScripts": + { + "$className": "StarterPlayerScripts", + "$path": "Client" + } } } } \ No newline at end of file diff --git a/place.project.json b/place.project.json deleted file mode 100644 index 99bf692..0000000 --- a/place.project.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "name": "Super Nostalgia Zone", - - "tree": - { - "$className": "DataModel", - - "ServerStorage": - { - "$className": "ServerStorage", - - "MainModule": - { - "$path": "init.lua", - - "ReplicatedFirst": - { - "$className": "Folder", - - "JoinScript": - { - "$path": "Resources/GameJoin" - } - }, - - "ReplicatedStorage": - { - "$className": "Folder", - - "SafeChatTree": - { - "$path": "Resources/SafeChat" - } - }, - - "ServerStorage": - { - "$className": "Folder", - - "StandardTools": - { - "$path": "Tools" - } - }, - - "StarterGui": - { - "$className": "Folder", - - "UI": - { - "$className": "ScreenGui", - - "RootFrame": - { - "$path": "UI" - } - } - }, - - "ServerScriptService": - { - "$path": "Server" - }, - - "StarterPlayerScripts": - { - "$path": "Client" - }, - - "StarterCharacterScripts": - { - "$path": "Character" - } - } - } - } -} \ No newline at end of file diff --git a/rojo-build.bat b/rojo-build.bat deleted file mode 100644 index dcab747..0000000 --- a/rojo-build.bat +++ /dev/null @@ -1,4 +0,0 @@ -@echo off -rojo build -o Test.rbxmx - -pause \ No newline at end of file diff --git a/rojo-serve.bat b/rojo-serve.bat deleted file mode 100644 index 7bb4b43..0000000 --- a/rojo-serve.bat +++ /dev/null @@ -1,4 +0,0 @@ -@echo off -rojo serve place.project.json - -pause \ No newline at end of file