What do you want to achieve? Keep it simple and clear!
I want to make a tool that makes you spin and fly up like a helicopter.
What is the issue? Include screenshots / videos if possible!
The events are not firing, like Equipped or Activated. It does not have a handle, but RequiresHandle is false. This is the code so far, the print statement does not run.
script.Parent.Equipped:Connect(function()
print("eq")
local char = script.Parent.Parent
local hum :Humanoid = char:WaitForChild("Humanoid")
local animator = hum:WaitForChild("Animator")
local Anim = script:WaitForChild("Animation")
local track = animator:LoadAnimation(Anim)
track.Priority = Enum.AnimationPriority.Action
track:Play()
end)
Here is the ancestry, too.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried using .Changed and checking if prop == "Parent" --prop is the property changed
and then if script.Parent.Parent:FindFirstChild("Humanoid") ~= nil but it still wouldn’t work.
I tried looking on the dev forum but it seems nobody is having the same issue.
This is the code, on the LocalScript in StarterPlayerScripts.
local plr = game.Players.LocalPlayer
plr.CharacterAdded:Connect(function(char)
print("a")
for i = 1, 3 do
local randomtool = game.ReplicatedStorage.Tools:GetChildren()[math.random(1,#game.ReplicatedStorage.Tools:GetChildren())]
randomtool.Parent = plr.Backpack
end
char.Humanoid.Died:Connect(function()
for i, v in plr.Backpack:GetChildren() do
v.Parent = game.ReplicatedStorage.Tools
end
if char:FindFirstChildWhichIsA("Tool") then
char:FindFirstChildWhichIsA("Tool").Parent = game.ReplicatedStorage.Tools
end
end)
end)
Basically on the client, it parents the tools to the player, so i dont get repeats, and when they die it is added back on the client. I couldn’t find a better way of getting no repeats.