So I'm trying to build off the the BloxyColaScript in most food gear to add hunger/thirst quenching properties.
When I tried getting player from character (which I'm assuming is tool.parent) It comes with an error
21:33:33.799 - GetPlayerFromCharacter is not a valid member of Model
This is the script:
(The error comes from line 24)
local Tool = script.Parent;
enabled = true
function onActivated()
if not enabled then
return
end
enabled = false
Tool.GripForward = Vector3.new(0,-.759,-.651)
Tool.GripPos = Vector3.new(1.5,-.5,.3)
Tool.GripRight = Vector3.new(1,0,0)
Tool.GripUp = Vector3.new(0,.651,-.759)
Tool.Handle.DrinkSound:Play()
wait(3)
local player = Tool.Parent:GetPlayerFromCharacter(character)
local thirst = player.PlayerGui.Thirst
if (thirst ~= nil) then
print("The player is here!")
else print ("Player not here :(")
end
end
Tool.GripForward = Vector3.new(-.976,0,-0.217)
Tool.GripPos = Vector3.new(0.03,0,0)
Tool.GripRight = Vector3.new(.217,0,-.976)
Tool.GripUp = Vector3.new(0,1,0)
enabled = true
function onEquipped()
Tool.Handle.OpenSound:play()
end
script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
I'm testing it out by printing if player is there or not, but it doesn't print

2 comments
its a member of players*
There is an Edit feature that allows you to fix typos in your post, just so you know.