Below is a server script. For some reason "hekki" is not being printed at all. The code is supposed to delete the item in hand and also delete that name item from starter gear. Any ideas on why this isn't working?
game.Players.PlayerAdded:Connect(function(player)
print("hekki")
script.Parent.MouseButton1Click:Connect(function()
print("hello!")
--local character = player.Character or player.CharacterAdded:Wait()
--local player = game.Players:GetPlayerFromCharacter(Character)
local SG = player.StarterGear
local tool = player.Character:FindFirstChildOfClass("Tool")
--local name = tool.Name
if tool then
print("hello!!!")
tool:Destroy()
end
if SG:FindFirstChild(tool.Name) then
SG[tool.Name]:Destroy()
end
end)
end)

1 comment
Is there anything else in the script? It could be yielding and is your script disabled?