I have a bit of a game where a users cursor is "sent" over to another players screen. Everything works perfectly fine except whenever the player dies they stop seeing the GUI; However, the other player (that hasn't died yet) will still see the died players cursor. There are no errors, and it would seem that the holdup is on line 5 of the localscript where it waits for the cursor GUI default to load so that it can be cloned. I've tried making the wait just a general "wait(5)" or something like that but even still it doesn't go past.

So what's going on?

Local Script:

local AddEvent = game:GetService("ReplicatedStorage").AddCursor

AddEvent.OnClientEvent:Connect(function(Player)
    if Player == game.Players.LocalPlayer then return end
	repeat wait() until script.Parent.Parent:FindFirstChild("Cursor")
    local Cursor = script.Parent.Parent.Cursor:Clone()
    Cursor.Name = Player.Name
    Cursor.TextLabel.Text = Player.Name
    Cursor.Parent = script.Parent
end)

Server Script:

local Players = game:GetService("Players")

local AddCursorEvent = game:GetService("ReplicatedStorage").AddCursor

Players.PlayerAdded:Connect(function(Player)
    AddCursorEvent:FireAllClients(Player)
    Player.CharacterAdded:Connect(function()
	    for i, v in pairs(Players:GetPlayers()) do
		    AddCursorEvent:FireClient(Player, v)
	    end
    end)
end)

StarterGui: enter image description here

2 comments

0

I think it didn't find the cursor frame/whatever you call it

so any script where it got added

0

I think it didn't find the cursor frame/whatever you call it

so any script where it got added