Let’s say I had a local script inside of starter player scripts.this script would create a intvalue inside of the local player. Would this intvalue be in danger of being exploited? How would I prevent it by using a remote event?
Localscripts are, as the name implies, local to the client. The things they do are not replicated to the server meaning if you were to create a value with one, only the client would be able to see it and requesting it from the server would throw you an exception. If you need a intvalue inside of a player then you can just put an intvalue into their backpack, If its something thats not accomplishable through tables and module scripts that is. If your intent on using a script for inserting it then you can use a serverscript within ServerScriptService with some code to run on player join and create the intvalue wherever needed.
Something like:
game.Players.PlayerAdded:Connect(function(player)
local val = Instance.new("IntValue")
val.value = 100 --Whatever you want it to be at initialization.
val.Parent = game.Players:FindFirstChild(player).Backpack --Or whatever directory you want to parent the value to.
end)
1 Like
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.