Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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!

2 comments

0

can u rewrite the script cuz i di it AND IT STILL WONT WORK

0

I've fixed a few more lines, and it should work now

This discussion is preserved as it was. New answers, comments, and votes are closed.