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

Local Script not working, And no errors in output?

Asked by
KenzaXI 166
9 years ago

Hi, I've made a Script to clone a Gui from Lighting into PlayerGui, But it won't do that. As usual the Roblox wiki is no help. Here's the script:

repeat wait() until game.Players.LocalPlayer 
local Player = game.Players.LocalPlayer
game.Players.PlayerAdded:connect(function()
    local Gui = game.Lighting.MovesGui1:Clone()
    Gui.Parent = Player.PlayerGui
end)

Cheers.

1 answer

Log in to vote
2
Answered by 9 years ago

The problem you're facing is that you're using a Local Script to perform a server-side task which it can't do. So use a regular script instead!

game.Players.PlayerAdded:connect(function(Player)
   local PlayerGui = Player:WaitForChild("PlayerGui")--This wait until the PlayerGui has loaded so it doesn't cause an error later on.
    if Player then
    game.Lighting.MovesGui1:Clone().Parent = PlayerGui
    end
end)

~ UserOnly16Charcters Hoped I helped you to answer your question! If you have any further question, don't hesitate to comment below!!

0
Won't Work KenzaXI 166 — 9y
0
@KenzaXI I tested the script and it seems to work perfectly fine on my end. So I don't know why it doesn't work for you. UserOnly20Characters 890 — 9y
Ad

Answer this question