

If I wanted to make an npc chase a player, but client-sided. Some people said that we shouldn’t store the important things in a client-side script.Ĭan we change a character’s WalkSpeed inside a local script, or should it be done only on the server? I mean even if the hacker changed his/ her speed, it would only affect themselves and other players won’t be able to see it. Oh and also is it better to store a local script/ a server script inside tools?Īnd so what kinds of stuff should we put inside client-side script. If EnemyHumanoid and EnemyHumanoid.Health > 0 then Local EnemyHumanoid = mouseTarget.Parent:FindFirstChildOfClass("Humanoid") If mouseTarget.Parent and mouseTarget.Parent ~= nil then If mouseTarget and mouseTarget ~= nil then GunEvent.OnServerEvent:Connect(function(player, mousePos, mouseTarget) GunEvent:FireServer(mousePosition, mouseTarget)Īnd this is the server script I put inside of the ServerScriptService local RS = game:GetService("ReplicatedStorage") Local Sound = Handle:WaitForChild("Activate") Local humanoid = char:WaitForChild("Humanoid") Local char = player.Character or player.CharacterAdded:Wait() Local Players = game:GetService("Players") Local Handle = Tool:WaitForChild("Handle")

Local GunEvent = RS:WaitForChild("GunEvent") This is the local script I put inside the Tool’s (Gun) Handle, which is in the StarterPack local RS = game:GetService("ReplicatedStorage") So is there a best way to do it? And I also need suggestions for the script! (Is it better also to put a script/ a local script inside of a tool?) (I added a debounce and it will have a slight delay for the clients when using the gun) If I add debounce to the server script, other clients with the same gun will experience a delay when using the gun. I think that if I fire remote events repeatedly, the script will exhaust. So, I recently made a gun by using remote events.
