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

Is there a better way to put a script in ServerScriptService? [SOLVED]

Asked by 8 years ago
Edited 7 years ago

This is a Script inside game.Workspace:

game.Players.PlayerAdded:connect(function(Player)

Player:WaitForChild("PlayerGui")

local PlayerGui = Player.PlayerGui

local AM = script.Admin
AM.Parent = game.ServerScriptService
AM.Disabled = false

local c = script.Login:Clone()
c.Parent = PlayerGui

end)

And this is a LocalScript inside game.Workspace.AdminCore.Login.PassBox:

script.Parent:TweenPosition(UDim2.new(0.5, -227, 0.5, -60))

script.Parent.Exit.MouseButton1Click:connect(function()
    script.Parent:TweenPosition(UDim2.new(0.5, -227, 2, 0))
    wait(1)
    script.Parent.Parent:Destroy()
end)

script.Parent.Login.MouseButton1Click:connect(function()
    local LoginVal = game.ServerScriptService.Admin.Login
    LoginVal.Value = script.Parent.PasswordBox.Text
    script.Parent:TweenPosition(UDim2.new(0.5, -227, 2, 0))
    wait(1)
    script.Parent.Parent:Destroy()
end)

What happens is Admin does not get out in ServerScriptService and ends up getting destroyed so doesn't run, and yes it does need to be in there.

0
Local Scripts don't work in workspace nor ServerScriptService. While FE is on regular scripts cannot access PlayerGui. User#11440 120 — 8y
0
I'm sorry I made a mistake. The LocalScript is cloned into game.Players.{PLR}.PlayerGui.Login.PassBox andrewboy159 18 — 8y

Answer this question