You see, I've been making a main menu gui and the teleporting works and team changing etc. However, when I try to hide the gui so the player can actually play, it doesn't do anything. My local script is inside the gui so I figured that if I try hide the gui it'll also disable the script that lets the team changing script work. I'm not exactly sure where to place my local script either as filteringenabled doesn't let you use LocalPlayer. I'll provide the scripts. Local Script:
local event = game:GetService("ReplicatedStorage"):WaitForChild("StartMenu") script.Parent.MouseButton1Down:connect(function() game.ReplicatedStorage.StartMenu:FireServer() --StartMenu is a RemoteEvent. end)
Normal Script (located in serverscriptservice):
local event = game:GetService("ReplicatedStorage"):WaitForChild('StartMenu') event.OnServerEvent:connect(function(player) print("Someone pressed the button!") player.TeamColor = BrickColor.new("Persimmon") player.Character.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(15.31,85.839,32.044)) player.Character.Humanoid.JumpPower = 50 player.Character.Humanoid.WalkSpeed = 16 player.PlayerGui.MenuStart.Enabled = false --Renamed to avoid confusion. end)
The server cannot access a UI, because a UI is on the computer (client) and the server is in the roblox's server. The roblox's server is not your computer. You should put the script that changes the UI in a localscript.
The argument player is just a string. Try this:
local event = game:GetService("ReplicatedStorage"):WaitForChild('StartMenu') event.OnServerEvent:connect(function(plr) local player = game:GetService("Players"):FindFirstChild(plr) -- Look for player with the name in plr player.TeamColor = BrickColor.new("Persimmon") player.Character.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(15.31,85.839,32.044)) player.Character.Humanoid.JumpPower = 50 player.Character.Humanoid.WalkSpeed = 16 player.PlayerGui.MenuStart.Enabled = false --Renamed to avoid confusion. end)