So, I made a script that once you click a book and have enough in-game currency, it will give you a unique sitting position. However, the script breaks when used in a local script (I already tried it inside of StarterPlayerScripts so it did run) and since it's not in a local script, that means that once a single person clicks on the book the entire server has the sitting position. I'm not looking for a script of any kind (unless it's about the script I'm showing), but it's about if I should use a different kind of script, if I should use remote events/functions, or if I need to use a different combination of both. Here's the script:
local book = game.Workspace.Claustrophobia.Union local anim = game.Workspace.sitanim local animscript = game.Workspace.Animation book.ClickDetector.MouseClick:Connect(function(player) local rep = player:WaitForChild("leaderstats"):WaitForChild("Reputation") for i, v in pairs(game.Workspace:GetDescendants()) do if v.ClassName == "Seat" then if rep.Value >= 1000 then local scriptclone = animscript:Clone() scriptclone.Parent = v local animclone = anim:Clone() animclone.Parent = v end end end end)
If you could help I would really like it!
Use remote events. Execute this code on the server for when they click, and you should be fine.
Hope this helped!