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

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

Asked by 5 years ago
Edited 5 years ago

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

Log in to vote
0
Answered by
Torren_Mr 334 Moderation Voter
5 years ago

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.

Ad

Answer this question