So I have a shop gui and it wont work I used a regular script it wont say I clicked.If I used a local script it will work only for the client.Plz help
Script:
script.Parent.MouseButton1Click:Connect(function()
print("yes")
local player = script.Parent.Parent.Parent.Parent.Parent
local stats = player:WaitForChild("leaderstats")
local popularity = stats:WaitForChild("Popularity")
local boost = stats:WaitForChild("Boost")
if popularity and boost then
print("good")
if popularity.Value >= 25 then
popularity.Value = popularity.Value - 25
boost.Value = boost.Value + 1
end
end
end)

5 comments
Making this a local script and using a Remote Event would work. You may also change local player == script.Parent.Parent.. and so on - to game.Players.LocalPlayer
iTS A script
not a local script
handle the mousebutton1click in a local script and a fire a remote event to the server to handle changing the popularity and boost values
you can not use a Script in GUI's only if you replicate GUI from server