What do you want to achieve?
I want to get the player from the character when you touch a part.
What is the issue?
I cant figure out how to do this
What solutions have you tried so far?
Here is what tried.
script.Parent.Touched:Connect(function(touched)
if touched.Player.leaderstats.money.Value >= 0 then
game.ServerStorage.orgdropper.Parent = game.Workspace
end
end)
I’m getting the “Player is not a valid member of the character” message.
Any help appreciated!
You can create a variable that represents the player to make it easier.
local player = touched.Parent:GetPlayerFromCharacter()
--[[ you need the .Parent because the 'touched'
represents a body part from the character, not the
character model itself
--]]
if player.leaderstats.money.Value >= 0 then
game.ServerStorage.orgdropper.Parent = game.Workspace
end
script.Parent.Touched:Connect(function(touched)
local player = game:GetService("Players"):GetPlayerFromCharacter(touched.Parent)
if player then
if player.leaderstats.money.Value >= 0 then
game.ServerStorage.orgdropper.Parent = game.Workspace
end
end
end)