Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My buyscript doesnt work. it only works in a localscript, and yeah it doesnt work?

Asked by
71ua 0
5 years ago

This is what the script does: it is supposed to change a value in their stats. but it doesnt work though. (its supposed to be a normal script, not local, but when i do localscript, it does work, but normal script don't)

local player = game.Players.LocalPlayer

local points = player.stats:FindFirstChild("Points")

local swordz = player.stats.swords

local sword = swordz.Default

local price = 0

script.Parent.MouseButton1Click:Connect(function()

if points.Value >= price then

sword.Value = true

sword.Eq.Value = true

swordz.Linked.Eq.Value = false

end

end)

0
is script.Parent a GUI? in this case, it will only work in a local script because GUIs can only be manipulated through a local script. You would need to set up remote events to handle the point changing from the server side if this is the case. MezornoIV 25 — 5y
0
I would also like to point out that LocalPlayer is undefined in a server script, because the script is available to everyone in the game, and not localized to one specific player (the client), like local scripts do. MezornoIV 25 — 5y

Answer this question