I want to make my tool work
I am cloning it from the server via. RemoteEvent, but when I do so the tool won’t work.
Devforum
I am using a localscript in my tool and it fire’s an event to make the player grab but when doing so the print functions don’t work. It clones the tool into the player from the server so that isn’t that problem. I have the Script which is in ServerScriptService that checks if the event has been fired from the client. And the LocalScript is in the tool.
-- LOCAL SCRIPT
script.Parent.Activated:Connect(function()
print("Tool Used")
if script.Parent.Parent:FindFirstChild("Humanoid") then
print("Humanoid Found")
local animation = script:WaitForChild("Grab")
local animationTrack = script.Parent.Parent:FindFirstChild("Humanoid"):LoadAnimation(animation)
animationTrack:Play()
game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent"):FireServer()
end
end)
-- SERVER SCRIPT
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player)
print("RUNNING")
rayTest(player)
end)
--SERVER SCRIPT THAT ADDS TOOL
game.ReplicatedStorage.GiveTools.OnServerEvent:Connect(function(player,tool)
for i,v in pairs(game.ReplicatedStorage:WaitForChild("TransfurCosmetics"):WaitForChild(tool):WaitForChild("Tools"):GetChildren()) do
v:Clone().Parent = player.Backpack
end
end)