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

Why wont my coin giver script work outside of roblox studio but will work in the studio?

Asked by 6 years ago

Hello, and thank you for taking the time to resolve my problem.

So I have a couple of scripts that are supposed to show a gui to some people and when they click on it they should receive money. These scripts work in roblox studio, and when the person clicks on the gui it will give them the money. However, when I leave the studio or start a local server to test the scripts it will show the gui, but they don't receive the money and nothing happens. I want to be able to get money when the gui is clicked. I'm not entirely sure where the problem is so sorry for the inconvenience. If more code is needed I will gladly give more code however I thought this would be necessary to include. I do have school so sorry for long time for response.

Code:

AddMoney

while true do
script.Parent.Mo[](http://)useButton1Click:connect(function(player)
script.Parent.Parent.Parent.Parent.leaderstats.Coins.Value = script.Parent.Parent.Parent.Parent.leaderstats.Coins.Value + 5
wait(0.1)
end)
wait(0.1)
end

Leader Board Script

while (true) do
game.Players.PlayerAdded:connect(function(player)
local leader = Instance.new("Model")
leader.Name = "leaderstats"
leader.Parent = player

local coins = Instance.new("IntValue")
coins.Name = "Coins"
coins.Value = 0
coins.Parent = player.leaderstats

local kills = Instance.new("IntValue")
kills.Name = "Kills"
kills.Value = 0
kills.Parent = player.leaderstats
end)
wait(0.1)
end

Image 1

Image 2

Answer this question