SERVER
utilitiyEvents.closeGUI.OnServerEvent:Connect(function(plr,Gui)
if typeof(Gui) ~= "string" then return end
if plr.PlayerGui:FindFirstChild(Gui) then
plr.PlayerGui[Gui]:Destroy()
end
end)
utilitiyEvents.toggleSprint.OnServerEvent:Connect(function(player,toggle)
if typeof(toggle) ~= "boolean" then return end
player.Character.Humanoid.WalkSpeed = if toggle then 35 else 16
end)
CLIENT/LOCAL SCRIPT
local UIS = game:GetService('UserInputService')
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Character = Player.Character or script.Parent
local replicated = game:GetService("ReplicatedStorage")
local remotes = replicated:WaitForChild("Remotes")
local utilRemotes = remotes:WaitForChild("Utility")
UIS.InputBegan:connect(function(input,processed)
if processed then return end
if input.KeyCode == Enum.KeyCode.LeftShift then
utilRemotes:WaitForChild("toggleSprint"):FireServer(true)
end
end)
UIS.InputEnded:connect(function(input)
if input.KeyCode == Enum.KeyCode.LeftShift then
utilRemotes:WaitForChild("toggleSprint"):FireServer(false)
end
end)
note!
i do want to reuse those events too