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.
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())