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

value of players not working with a if statment why not?

Asked by
hokyboy 270 Moderation Voter
6 years ago

script.Parent.MouseButton1Click:connect(function() if game.Players.LocalPlayer.leaderstats.Cash.Value == 100 then game.Players.LocalPlayer.leaderstats.Cash.Value = game.Players.LocalPlayer.leaderstats.Cash.Value + 75 script.Parent.Parent.Parent.OPen.Visible = true script.Parent.Parent.Parent.Sell.Visible = true game.ServerStorage.houses.House1:clone().Parent = game.Workspace script.Parent.Parent:Destroy()

game.ServerStorage.Items.Bank1:Clone() if game.ServerStorage.Items.Bank2.Parent == game.Workspace then game.Workspace.Bank2:Destory() end

end end)

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

First; please use a code block when posting code, and give us context. Second; always try to make your code neat and index it and everything. Also remember to leave notes for yourself so you can read what you wrote.

If this happens to help, please accept the answer!

Your problem is that you must've used the "clone" wrong. Please give me your error and this would be easier.

EDIT: Move the banks to ReplicatedStorage for this to work.

script.Parent.MouseButton1Click:connect(function() 
    if game.Players.LocalPlayer.leaderstats.Cash.Value == 100 then          
            game.Players.LocalPlayer.leaderstats.Cash.Value =           game.Players.LocalPlayer.leaderstats.Cash.Value + 75  --this is all one line, so fix that.
            script.Parent.Parent.Parent.OPen.Visible = true --this line might be broken
            script.Parent.Parent.Parent.Sell.Visible = true --this line might be broken
            local a = game.ReplicatedStorage.houses.House1:Clone()
            a.Parent = workspace 
            script.Parent.Parent:Destroy()

            game.ReplicatedStorage.Items.Bank1:Clone() --Use "replicatedStorage" instead!
        if game.ReplicatedStorage.Items.Bank2.Parent == game.Workspace then             
            game.Workspace.Bank2:Destory()
        end
    end --make ends neat!
end)

--i think the lines making things visible is breaking, but I have no way to tell. just ignore this if the script works.

This isn't tested, but all I saw was that your "if" was in the wrong place! make a new line for that!

0
can u rewrite the script cuz i di it AND IT STILL WONT WORK hokyboy 270 — 6y
0
I've fixed a few more lines, and it should work now MakeYourEscape 334 — 6y
Ad

Answer this question