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

(SOLVED) Im trying to make a script using "if" in StringValue but doesn't work, what is wrong?

Asked by 6 years ago
Edited 6 years ago

i cant find the error, im trying to make when click in the gui if StringValue is GomuGomuNoMi clone the gui in lighting and put in starterGui.hotbar.SkillBar1 and if there are something in skill bar 1 that dont is called SkillOff or SkillOffPermanently he will put the gui in skill bar 2, and the same thing in 2, 3 and 4, but i cant find the error

function Click(mouse)
    if script.Parent.Parent.Parent.Parent.stats.AkumaNoMi.Value = GomuGomuNoMi then
        game.Lighting.GomuGomuNoPistol:clone() = script.Parent.Parent.SkillBar1
    end
end

script.Parent.MouseButton1Down:connect(Click)

what is wrong?

(SOLVED)

i re-created the script, and now it works, look

Plr = game.Players.LocalPlayer

script.Parent.MouseButton1Down:connect(function()
for _,v in pairs(Plr.PlayerGui:GetChildren()) do
if v.Name == script.Parent.Name then
v:Destroy()
end
end
if game.Players.LocalPlayer.stats.AkumaNoMi.Value == "GomuGomuNoMi" then
Tool = game.Lighting.GomuGomuNoPistol:Clone()
Tool.Parent = Plr.PlayerGui.Hotbar.SkillBar1
end
end)

0
Instead of just typing GomuGomuNoMi, surround it in quotes since it is a string like "GomuGomuNoMi". RayCurse 1518 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

The second line isn't correct. In an if statement you must use two equals signs for it to work. So it would be:

if script.Parent.Parent.Parent.Parent.stats.AkumaNoMi.Value == GomuGomuNoMi then

I highly recommend using output bar so you can see what goes wrong in your script.

0
still not working, now the error is in :clone() "=" darkzerobits 92 — 6y
0
but thanks for help ^^ darkzerobits 92 — 6y
0
thanks for the help, but i did it ^^ darkzerobits 92 — 6y
Ad

Answer this question