✓ Accepted answer
In a server script you cant even get the player by using >game.Player.LocalPlayer >. you can see it by 'LocalPlayer', its local.
You can also add debounce for not creating like 1000000 of hints like here:
local part = script.Parent
local debounce = false
if debounce then
return
end
debounce = true
part.Touched:connect(function()
print("Not spammed")
end)
debounce = false
if you want to know more on debounce, you can go one roblox wiki here
For beign sure its a player touching the part you can add this little code like that:
if hit.Parent:FindFirstChild("Humanoid") then
end
here's the you're code:
part = script.Parent
local debounce = false
part.Touched:connect(function(hit)
if debounce then return end
debounce = true
if hit.Parent:FindFirstChild("Humanoid") then
hit.Transparency = 1
local name = hit.Parent.Name
local hint = Instance.new("Hint", workspace)
hint.Text = name.." Has touched me!"
wait(1)
hint:remove()
end
debounce = false
end)
1 comment
Write the script for me, please. I am not sure how to rewrite it.