When I run this server script, hekki does not print. Any ideas on why this isn't happening? Its parent is an image button.
local Players = game:GetService("Players")
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)

4 comments
Try replacing print("hekki") to if player then print("hekki")
why r u using playeradded?????
where is the script located?
It's under Starter GUI