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

0

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

0

iTS A script

0

not a local script

0

handle the mousebutton1click in a local script and a fire a remote event to the server to handle changing the popularity and boost values

0

you can not use a Script in GUI's only if you replicate GUI from server