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

Error Unexpected Unicode character: U+2028. Did you mean ''?

The error occurs on line 11 whenever I start the game. I can't figure out whats going wrong.

local PhysicalCube = workspace.Cube
local replicatedstorage = game:GetService("ReplicatedStorage")
local remotes = replicatedstorage:WaitForChild("Remotes")

local function movementsuspend()
	print("EventFired")
	local parts = script.Parent:GetTouchingParts()
	
	for i, v in pairs(parts) do
		local part = workspace:FindFirstChild(parts)
 		if part.Name == "Cube" then
			print("key suspended")
			PhysicalCube.SuspendedKeys.W.Value = true
		else
			PhysicalProperties.SuspendedKeys.W.Value = false
		end
	end
end

remotes:WaitForChild("W").OnServerFire:Connect(movementsuspend())
remotes:WaitForChild("S").OnServerFire:Connect(movementsuspend())
remotes:WaitForChild("A").OnServerFire:Connect(movementsuspend())
remotes:WaitForChild("D").OnServerFire:Connect(movementsuspend())

From what iv'e read its some kind of weird invisible character, and iv'e tried retyping the line, but its giving me the same error.

1 answer

✓ Accepted answer
local PhysicalCube = workspace.Cube
local replicatedstorage = game:GetService("ReplicatedStorage")
local remotes = replicatedstorage:WaitForChild("Remotes")

local function movementsuspend()
    print("EventFired")
    local parts = script.Parent:GetTouchingParts()

    for i, v in pairs(parts) do
        local part = v
        if part.Name == "Cube" then
            print("key suspended")
            PhysicalCube.SuspendedKeys.W.Value = true
        else
            PhysicalProperties.SuspendedKeys.W.Value = false
        end
    end
end

remotes:WaitForChild("W").OnServerFire:Connect(movementsuspend())
remotes:WaitForChild("S").OnServerFire:Connect(movementsuspend())
remotes:WaitForChild("A").OnServerFire:Connect(movementsuspend())
remotes:WaitForChild("D").OnServerFire:Connect(movementsuspend())

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