Here is my code:
local Player = game.Players.LocalPlayer
function HitByPlayer(ObjectTouched)
if ObjectTouched == game.Players:GetChildren() then
Player:GetChildren().CanCollide = false
end
end
function HitByObject(ObjectTouched)
if ObjectTouched ~= game.Players:GetChildren() then
Player:GetChildren().CanCollide = true
end
end
Player.Touched:Connect(HitByPlayer())
Player.Touched:Connect(HitByObject())
I am very new to Roblox Lua. So if this information I am going to give to you is fairly stupid, thats why. It is a Local Script. And it is also placed inside of the workspace. What I am trying to do is to switch your player's CanCollide to false when you run into another player and switch it to true when you run in to something that isn't a player. The code looks right to me. I don't know what is wrong. I hope you can find the solution. Thank you.

2 comments
If you would turn CanCollide false then the player would fall trough the map btw.
Yes, I realized that. It was just a typo in the title. I changed it.