Hello,

I suppose my question is a bit self-explanatory. Not sure why I get this error, nor what is wrong with my script. Help is appreciated!

local repStorage = game:GetService("ReplicatedStorage")
local plankRemote = repStorage:WaitForChild("plankRemote")
local planksTrigger = game.Workspace.FallingPlanks.PlankTrigger

planksTrigger.Touched:Connect(function(hit)
    local player = hit.Parent:FindFirstChild("Humanoid")
    if player then
	   print("touched")
	   plankRemote:FireClient(game.Player:GetPlayerFromCharacter(player))
    end
end)

5 comments

0

you can't get a player from a humanoid

0

theking is right you need to change it to player.Parent in the argument for getplayerfromcharacter

0

change .Player to .Players and use hit.Parent for get player not humanoid

0

Doesn't work..? ^

0

you put game.Players:GetPlayerFromCharacter(hit.Parent) ? if yes try to use game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)