local InviteId = script.Parent.Name
for _, user in pairs(game.Players:GetChildren()) do
local UserGui = user:WaitForChild("PlayerGui", 60)
local GAMEIDGUI = UserGui:WaitForChild("GameGui", 60):FindFirstChild(InviteId)
local PIXEL = GAMEIDGUI.DrawingBoard:FindFirstChild(RemovePixelName)
if PIXEL then
PIXEL:Destroy()
print(user) -- Optional
else
warn("Can't find Player2") -- Optional
end
end
it worked at first in here but it started to never work anymore…
Im trying to make a eraser in a drawing game I’m making. But when its getting deleted. The eraser only destroy the frame on the player’s UI who fired the event. Thanks for the help, i appreciate it!
game.ReplicatedStorage:FindFirstChild(script.Parent.Name).EraseEvent.OnServerEvent:Connect(function(player,RemovePixelName)
local InviteId = script.Parent.Name
game.ReplicatedStorage:FindFirstChild(InviteId).EraseEvent.EraseAllClient:FireAllClients(RemovePixelName)
print(RemovePixelName) -- Test only to know if the function is running
end)
Client
game.ReplicatedStorage:FindFirstChild(script.Parent.Name).EraseEvent.EraseAllClient.OnClientEvent:Connect(function(RemovePixelName)
if script.Parent.DrawingBoard:FindFirstChild(RemovePixelName) then
script.Parent.DrawingBoard:FindFirstChild(RemovePixelName):Destroy()
print(RemovePixelName) -- Test only to know if the function is running
end
end)