CanCollide script does not work

local partToChange = game.Workspace.JumpPart

game.Players.PlayerChatted:Connect(function(chatType, player, message, targetPlayer)
	if message == "jump" then
		partToChange.Transparency = 0.5
		partToChange.CanCollide = false
		task.wait(3)
		partToChange.Transparency = 1
		partToChange.CanCollide = true
	end
end)

This code does not work and shows “The current identity (2) cannot PlayerChatted (lacking permission 3)” as an error the script is in serverscriptservice and the script is supposed to turn a block half transparent and let a player go through the block.

You need to change this to:

game.Players.PlayerAdded:Connect(function(plr)
       plr.Chatted:Connect(function(msg)
            ----- code here
      end)
end)
3 Likes

there is a syntax error at end for some reason it is underlined red

never mind, thank you! I forgot to change the variable to msg

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.