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

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

Asked by
Prioxis 673 Moderation Voter
10 years ago

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

Log in to vote
4
Answered by
HexC3D 830 Moderation Voter
10 years ago
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.

1
oh okay thank you Prioxis 673 — 10y
1
Yay it worked thanks man so much! Prioxis 673 — 10y
Ad

Answer this question