Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Player is not a valid member of DataModel?

Asked by 5 years ago

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)
0
you can't get a player from a humanoid theking48989987 2147 — 5y
0
theking is right you need to change it to player.Parent in the argument for getplayerfromcharacter AnonymousDeveloper13 22 — 5y
0
change .Player to .Players and use hit.Parent for get player not humanoid yHasteeD 1819 — 5y
0
Doesn't work..? ^ Similaritea 58 — 5y
0
you put game.Players:GetPlayerFromCharacter(hit.Parent) ? if yes try to use game:GetService("Players"):GetPlayerFromCharacter(hit.Parent) yHasteeD 1819 — 5y

Answer this question