hello great people hope you are having a great day but can you help me here for a sec i'm making it so if you get a kill a gui get deleted (a gun game) but it gets in the player gui and then it just does not want to delete the gui i made a print function and it prints it so i don't under stand and yes the gui is in the player when i tell the script to delete the gui
here is the script
local Remote = game:GetService('ReplicatedStorage'):WaitForChild('GunClone')
Remote.OnServerEvent:Connect(function(player,gun)
for _, object in pairs(player.PlayerGui:GetChildren()) do
if object.Name == "MainGui" then
object:Destroy()
else
print("No gui")
end
end
and i have more script under that so i cant close it off here is the FULL script
local Remote = game:GetService('ReplicatedStorage'):WaitForChild('GunClone')
Remote.OnServerEvent:Connect(function(player,gun)
for _, object in pairs(player.PlayerGui:GetChildren()) do
if object.Name == "MainGui" then
object:Destroy()
else
print("No gui")
end
end
local m = player.Character:GetChildren()
for i = 1, #m do
if m[i].ClassName == "Tool" then
m[i]:Remove()
end
end
wait()
local ChosenGun = game.ReplicatedStorage:WaitForChild(gun):Clone()
ChosenGun.Parent = player:WaitForChild('Backpack')
wait(0.1)
ChosenGun.Parent = player.Character
end)

1 comment
no sorry i have more script under this lines so i can't close it off yet