So i have this script that goes inside my bullet, its simple, the bullets name is the player that shot it name. and the way it gets the correct player to enable the gui is that it tostrings bullet name and just do game.Players.(name).PlayerGui.ScreenGui.Visible = true. but when it attempts that it says attempt to index nil with screengui. how can i fix this? also the script is a normal script, not a local
function ont (hit)
if hit.Parent.Name ~= (script.Parent.Name) then
local humanoid = hit.Parent:findFirstChild("Humanoid")
if humanoid ~= nil then
local name = tostring(script.Parent.Name)
script.Parent = workspace
print("got hit")
wait(0.2)
--if humanoid.Health >= 1 then
print("humanoid died")
game.Players.name.PlayerGui.ScreenGui.Enabled=true
wait(1)
game.Players.name.PlayerGui.ScreenGui.Enabled=false
--end
end
end
end
script.Parent.Touched:connect(ont)

1 comment
forgot about that detail, yeah