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

How Do i fix This Error: Expected 'then' when parsing if statement, got ',' ?

Script:

click = 0 local plr = game,Players.LocalPlayer while wait()do if click == plr.leaderstats.Crowns,Value then local random = math.random(1,1000) local xnew = Random/1000 local new = game.ReplicatedStorage.ClickingEffect:Clone() new.Parent = script.Parent new.TextBox.Position = UDim2.new(xnew,0,1,0) click = plr.leaderstats.Crowns.Value end end

2 comments

0

always use "." instead of ","

0

Format your code.

2 answers

click = 0
local plr = game

while wait() do
    if click == plr.leaderstats.Crowns then
        local random = math.random(1, 1000)
        local xnew = random / 1000
        local new = game.ReplicatedStorage.ClickingEffect:Clone()
        new.Parent = script.Parent
        new.TextBox.Position = UDim2.new(xnew, 0, 1, 0)
        click = plr.leaderstats.Crowns.Value
    end
end

this work yes

You used "," instead of "." so uh ye, here is the fix i guess:



click = 0 
local plr = game.Players.LocalPlayer 
while wait() do 
	if click == plr.leaderstats.Crowns.Value then 
		local random = math.random(1,1000) 
		local xnew = Random/1000 
		local new = game.ReplicatedStorage.ClickingEffect:Clone() 
		new.Parent = script.Parent new.TextBox.Position = UDim2.new(xnew,0,1,0) 
		click = plr.leaderstats.Crowns.Value 
	end
end

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