hi help me pls i cant figure out how to find a single player model in a server script
local script
-- set variables
local staff = script.Parent-- find the staff itself
local output = staff:FindFirstChild("Energizer")-- where the output will start
local player = game:GetService("Players").LocalPlayer-- getting the player and the humanoid
local character
repeat
character = player.Character
wait()
until character
local hum = character:WaitForChild("Humanoid")
local repstorage = game.ReplicatedStorage
-- set events and functions
local equipR6 = repstorage.equipR6
local equipR15 = repstorage.equipR15
function equipAnim(player)
--check if the body type is R6 or R15
if character:FindFirstChild("Lower Torso") then--if the body type is R15
print("R15")
local equipCallR15 = equipR15:InvokeServer()
elseif character:FindFirstChild("Torso") then--if body type is R6
print("R6")
local equipCallR6 = equipR6:InvokeServer()
end
end
--set the equip animation
staff.Equipped:Connect(equipAnim(player))
server script
local player = nil
local hum = nil
local repstorage = game.ReplicatedStorage--set the replicated storage variable
--set the remote events and functions
local equipR15 = repstorage:WaitForChild("equipR15")
local equipR6 = repstorage:WaitForChild("equipR6")
--play the animations
function playEquipAnimR6(player)
if game.Workspace[player.Name]:FindFirstChild("Torso") then--if the avatar type is R6
local equipR6 = Instance.new("Animation")--makes animation instance
equipR6.AnimationId = "rbxassetid://4967132516"
local equipAnimTrackR6 = hum:LoadAnimation(equipR6)--Use name
equipAnimTrackR6:Play()
end
end
function playEquipAnimR15(player)
if game.Workspace[player.Name]:FindFirstChild("Lower Torso") then--if the avatar type is R15
local equipR15 = Instance.new("Animation")--makes animation instance
equipR15.AnimationId = "rbxassetid://4967140370"
local equipAnimTrackR15 = hum:LoadAnimation(equipR15)--Use name
equipAnimTrackR15:Play()
end
end
equipR6.OnServerEvent = playEquipAnimR15()
equipR15.OnServerEvent = playEquipAnimR15()
