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

if statement not running even though its suppossed to..?

so. there is some varaibles in workspace. i have ONE varaible that says if the talk gui comes up or not. its false, and the if statement in my script checks for if its false (0) and it is, but the code in if statement is not running. help please! here is me code:

local SP = script.Parent

script.Parent.Parent.Enabled = true
while true do
wait(0.3)
if workspace.talking.Value == 1 then
script.Parent.talktext.BackgroundTransparency = 0
SP.talkguy.BackgroundTransparency = 0
SP.talktext.Text = workspace.talktext.Value
SP.talkguy.Text = workspace.talkguy.Value
if workspace.talking.Value == 0 then
SP.talktext.BackgroundTransparency = 1
SP.talkguy.BackgroundTransparency = 1
SP.talktext.Text = ""
SP.talkguy.Text = ""
end
end
end

1 answer

✓ Accepted answer

You forgot to end the first if at line 6. The code would need to be:

local SP = script.Parent

script.Parent.Parent.Enabled = true
while true do
wait(0.3)
if workspace.talking.Value == 1 then
script.Parent.talktext.BackgroundTransparency = 0
SP.talkguy.BackgroundTransparency = 0
SP.talktext.Text = workspace.talktext.Value
SP.talkguy.Text = workspace.talkguy.Value
end
if workspace.talking.Value == 0 then
SP.talktext.BackgroundTransparency = 1
SP.talkguy.BackgroundTransparency = 1
SP.talktext.Text = ""
SP.talkguy.Text = ""
end
end

If it doesn't work please comment.

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