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)
A little off topic from your actual problem, but I’d recommend changing the walk speed on the client. Otherwise sprinting will feel weird and laggy to players
And open it up to being hacked. Server is just the logic if done right any lag would be on your connection.
@ Creator That is some very fine programming. It covers all the bases. You must be setting up the remote incorrectly. Almost nothing you can do would make that any better. A few small tweaks could be added, but the logic looks to be sound.
An open book to an exploiter. Anything sensitive belongs on the server. I’m not going to argue; this is a known practice with all client-server applications on any platform.
Literally the only difference between doing it on server and client is that client is instant and server has an annoying delay. Both are equally exploitable.
Now you have me arguing. I mean no offence to you; this is just how it is. An exploiter cannot touch server scripts, and the server is the law to the client. All you need from the client is the trigger sent via remote. “any lag would be on your connection.”
Here’s a video of me changing the walkspeed on client after setting the walkspeed on the server. The client is actually able to change the value since the server will update the clients values, but the client can instantly change the values back. Servers are not safe in the sense that they have full control over the clients computer, but rather that they can store data safely without clients being able to read the data.
This won’t do anything. I’m not even gonna test something as ridiculous as this, you can do that yourself and prove yourself wrong. Stop wasting my time.
The walk speed is only changed on client, and the server will not be able to detect it. So this will do nothing.
Also, even if you keep resetting walk speed to 1 on a loop on the server, it won’t work, since for performance reasons, if you try to set a property to its current value, it won’t replicate to any clients.
Please stop embarrassing yourself, test these things before you post them.
Well, I’ve never had a problem with this. I work with Unity in C#. This is a known fact: the server has full control. I was unaware this was even possible here. I can only go off what I know to be true. You have made your point, and thank you for the clarification on this issue. However, the total toxicity of how you’re communicating is actually something to be embarrassed by; it screams entitlement. Your profile also states you are: “1000x developer. I am better than all of you.” Yet you stumble with simple basic tact. How else am I to take your replies as nothing more than troll-ish toxicity.
@ effbeecee Thank you for the clarification. Seeing is believing. I should not have assumed all platforms were the same..