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

0

Try replacing print("hekki") to if player then print("hekki")

0

why r u using playeradded?????

0

where is the script located?

0

It's under Starter GUI