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

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

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)

1 comment

0

Instead of just typing GomuGomuNoMi, surround it in quotes since it is a string like "GomuGomuNoMi".

1 answer

✓ Accepted answer

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.

3 comments

0

still not working, now the error is in :clone() "="

0

but thanks for help ^^

0

thanks for the help, but i did it ^^

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