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

Why won't this script for my GUI not work?

So i'm making a console script that when I type Console_GivePoints_1500 it gives me 1500 points

function Click()	
if script.Parent.Parent.TextBox.Text == "Console_GivePoints_1500"
	then
	script.Parent.Parent.Parent.Parent.Parent.leaderstats.Money.Value = script.Parent.Parent.Parent.Parent.Parent.leaderstats.Money.Value + 1500
end
end
script.Parent.MouseButton1Down:connect(Click)

but when i go to add the command

Console_SpawnEntity_Zombie like so

local zombie = game.Lighting.Zombie
function Click()	
if script.Parent.Parent.TextBox.Text == "Console_GivePoints_1500"
	then
	script.Parent.Parent.Parent.Parent.Parent.leaderstats.Money.Value = script.Parent.Parent.Parent.Parent.Parent.leaderstats.Money.Value + 1500
end
end
if script.Parent.Parent.TextBox.Text == "Console_SpawnEntity_Zombie"
	then
	zombie:Clone()
	zombie.Parent = game.Workspace
	end
script.Parent.MouseButton1Down:connect(Click)

both commands stop working when I do this and i've tried changing it from a regular script to a local script but it doesn't make a difference checking to see if the script type was the cause for the error... would anyone mind correcting my script for me? and give me some help on how to fix this error and make sure when I add in new commands this doesn't happen

1 answer

✓ Accepted answer
local zombie = game.Lighting.Zombie
function Click()    
if script.Parent.Parent.TextBox.Text == "Console_GivePoints_1500"
    then
    script.Parent.Parent.Parent.Parent.Parent.leaderstats.Money.Value = script.Parent.Parent.Parent.Parent.Parent.leaderstats.Money.Value + 1500
elseif script.Parent.Parent.TextBox.Text == "Console_SpawnEntity_Zombie" then
    zombie:Clone().Parent = game.Workspace
   end
end

script.Parent.MouseButton1Down:connect(Click)


Try looking into the elseif command, mk.

2 comments

1

oh okay thank you

1

Yay it worked thanks man so much!

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