Hi! I cannot figure out what is wrong with this script. I am getting error:
Workspace.Door.Script:23: unexpected symbol near ')'
Any help will be appreciated!
Original Code:
local tp = Vector3.new(game.Workspace.TPINSIDE.Position) script.Parent.Touched:connect(function(plr) local name = plr.Name local plrPart = game.Workspace:FindFirstChild(name) local dataFind = plr:FindFistChild("enter") if dataFind == nil then local data = Instance.new("IntValue") data.Parent = plr data.Name = "enter" data.Value = 1 plrPart.HumanoidRootPart.CFrame = CFrame.new(tp) else if dataFind.Value == 0 then dataFind.Value = 1 plrPart.HumanoidRootPart.CFrame = CFrame.new(tp) else if dataFind.Value == 1 then -- show message else print("Not a player") end end)
Cheers! WindNT
The problem lays in your if statement. You use else if
instead of elseif
, wich would mean it requires an end for every new if.
What you're basicly doing is:
script.Parent.Touched:connect(function(plr) if dataFind == nil then -- stuff else if dataFind.Value == 0 then -- stuff else if dataFind.Value == 1 then -- stuff else -- stuff end end) --see the problem here? Not enough ends.
The easy way to solve this:
You gotta change your else if
into elseif
, because it'd require a few extra ends otherwise. That's all.