Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

RemoteEvent firing and received, but the script isn't working?

The RemoteEvent fires and is received as it's prints it, but the PlayerGui parts do not work, as well as the CameraFix cloning into the Player's character.

train = game.ReplicatedStorage.C153
Camera = workspace.CurrentCamera


game.ReplicatedStorage.C153Spawn.OnServerEvent:connect(function(player)
	print("Event Received")
		player.PlayerGui.MainMenuGui.Screen.DriveFrame.Visible = false
		player.PlayerGui.MainMenuGui.Screen.Spawning.Visible = true
		player.PlayerGui.MainMenuGui.Screen.Spawning.Text = "Spawning..."
		wait(0.01)
		local clone = train:Clone()
		clone.Parent = workspace
		clone:MakeJoints()
		clone.Bogies.SD_Bogie:MakeJoints()
		clone.Bogies.SD_Bogie2:MakeJoints()
		wait(1)
		player.Character.HumanoidRootPart.CFrame = CFrame.new(-2449.474, 10.174, -198.335)
		player.PlayerGui.MainMenuGui.Screen.Spawning.Visible = false
		player.PlayerGui.MainMenuGui.Screen.IntroMusic:stop()
  script.Parent.CameraFix:clone().Parent = player.Character
end)

This is what is visible in the developer console: https://gyazo.com/80f97bddbd4561a789993d930de82abb

1 answer

If your game is Fe, the server can't see the descendants of PlayerGui, so you're going to make a client-handled RemoteEvent for GUI manipulating.

Also, the camera is client-sided only

--Local script
wait()
local player = game.Players.LocalPlayer
local GuiStuff = game.ReplicatedStorage.GuiStuff

GuiStuff.OnClientEvent:Connect(function(bool)
        if bool then
               player.PlayerGui.MainMenuGui.Screen.DriveFrame.Visible = false
               player.PlayerGui.MainMenuGui.Screen.Spawning.Visible = true
               player.PlayerGui.MainMenuGui.Screen.Spawning.Text = 'Spawning'
        else
               player.PlayerGui.MainMenuGui.Screen.Spawning.Visible = false
               player.PlayerGui.MainMenuGui.Screen.IntroMusic:Stop()
        end
end)
--Server code
local train = game.ReplicatedStorage.C153
local GUI = game.ReplicatedStorage.GuiStuff

game.ReplicatedStorage.C153Spawn.OnServerEvent:Connect(function(player)
        GUI:FireClient(player, true)
        wait()
        local clone = train:Clone()
        clone.Parent = workspace
        clone:MakeJoints()
        clone.Bogies.SD_Bogie:MakeJoints()
        clone.Bogies.SD_Bogie2:MakeJoints()
        wait(1)
        player.Character.HumanoidRootPart.CFrame = CFrame.new(-2449.474, 10.174, -198.335)
       GUI:FireClient(player, false)
       script.Parent.CameraFix:Clone().Parent = player.Character
end)

5 comments

0

No my game isn't FE and it works in Studio and did before this update that happened.

0

What is GuiStuff?

0

And it doesn't work anyway

0

What? You just said that it works in studio, also all games are Filtering Enabled.

0

Well, I meant before I added this script that my script worked in studio. This one doesn't.

This discussion is preserved as it was. New answers, comments, and votes are closed.