Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Problem with RemoteEvents?

Asked by
RoyMer 301 Moderation Voter
8 years ago

This script is suppose to find each player's frame (the name of the frame is the respective player's name), then these frames are cloned and all put in each player, as long as the name is not the same as the player's name (the one who's guis are being cloned into).

This is not giving me any error, yet it is not working as expected...

print("EventHappened") is not being printed?

In server script in Workspace

--      Clone other people's gui
--      function CloneGui()
        for i, v in pairs(Players) do
        local event = v.Backpack.CloneGui
        wait(2)
        event:FireClient(v)
        end

In RemoteEvent Backpack

local event = script.Parent.Parent:WaitForChild("CloneGui")
local player = game.Players.LocalPlayer

event.OnClientEvent:connect(function()
    local Players = game.Players:GetChildren()
    for i, v in pairs(Players) do
    if v:WaitForChild("PlayerGui").ScreenGui:FindFirstChild("PlayerPointsFrame") then
    local clonegui = v:WaitForChild("PlayerGui").ScreenGui.PlayerPointsFrame:FindFirstChild(v.Name):Clone()
    if clonegui.Name ~= player.Name then
    clonegui.Parent = game.Players:FindFirstChild(player.Name).PlayerGui.ScreenGui.PlayerPointsFrame
    end
    end
    end
    print("EventHappened")
end)
0
The event could very well be happening; try moving the print statement to after line 4. You use WaitForChild when you should probably only use FindFirstChild. If you have anything as a child of game.Players that isn't a player, that's why the print statement wouldn't get printed. chess123mate 5873 — 8y
0
It is working now in Studio but not in game, it is saying PlayerGui is not a valid member of Player :s RoyMer 301 — 8y

Answer this question