REPOST
My current is is that for some reason the reserve server in my game is not being called.
The code in my game has been thoroughly tested and has worked many many times before.
No changes have recently been made to the script that has made it not work.
Usually in Roblox Studio or in Roblox Player it will show that it’s called it, in Studio this is shown saying it can’t be called in Studio, in Roblox Player it just teleports the player.
There is the possibility I closed Roblox Studio without saving it or the Auto Save canceled, I am not sure, I am also open to the fact I did edit something and made that mistake and just overlooked it in memory.
Code:
--Variables and code for reserve server stuff
local MainMusic = game.SoundService["Distorted Reality Perception - Leon Riskin"]
local reserve = game.StarterGui.ScreenGui.PlayFrame.GameTypeButton1
local debounce = false
local ScreenGui = game.StarterGui.ScreenGui
reserve.MouseButton1Click:Connect(function()
print("starting reserve")
if debounce then return end
debounce = true
local ts = game:GetService("TeleportService")
local access = ts:ReserveServer(game.PlaceId)
ts:TeleportToPrivateServer(game.PlaceId, access, game.Players:GetPlayers())
warn("Teleporting everybody...")
task.wait(5)
debounce = false
end)
local Players = game:GetService("Players")
local player = script:FindFirstAncestorOfClass("Player")
local Camera = workspace.CurrentCamera
local Players = game:GetService("Players")
local isReserved = game.PrivateServerId ~= "" and game.PrivateServerOwnerId == 0
if isReserved == true then
print("reserved is true")
ScreenGui.Enabled = false
Camera.CameraType = Enum.CameraType.Custom
MainMusic.Playing = false
end
It is a Script in StartGui. The ScreenGui is completely separate.
I remember you posting this a while back and now I see a lot of things. First of all the script is in StarterGui and the Gui is in StarterGui. In this line: local reserve = game.StarterGui.ScreenGui.PlayFrame.GameTypeButton1
You are going into StarterGui, but the script is already inside of the PlayerGui.
You can try this:
--Variables and code for reserve server stuff
local MainMusic = game.SoundService["Distorted Reality Perception - Leon Riskin"]
local reserve = script.Parent.ScreenGui.PlayFrame.GameTypeButton1
local debounce = false
local ScreenGui = script.Parent.ScreenGui
reserve.MouseButton1Click:Connect(function()
print("starting reserve")
if debounce then return end
debounce = true
local ts = game:GetService("TeleportService")
local access = ts:ReserveServer(game.PlaceId)
ts:TeleportToPrivateServer(game.PlaceId, access, game.Players:GetPlayers())
warn("Teleporting everybody...")
task.wait(5)
debounce = false
end)
local Players = game:GetService("Players")
local player = script:FindFirstAncestorOfClass("Player")
local Camera = workspace.CurrentCamera
local Players = game:GetService("Players")
local isReserved = game.PrivateServerId ~= "" and game.PrivateServerOwnerId == 0
if isReserved == true then
print("reserved is true")
ScreenGui.Enabled = false
Camera.CameraType = Enum.CameraType.Custom
MainMusic.Playing = false
end
Basically, you are getting the Gui from StarterGui and trying to get a click from that. Which you should be getting the click from the player who has the Gui.
Alright great this has worked, I just wanted some advice on this: Since the cameras are at a current parts CFrame, as you can see near the end of the code im changing the cameras type, though this just still captures the current parts CFrame, should I destroy that part as soon as the game is loaded or use CFrame? I have used the CFrame changing but I can’t as well because of some issues. sorry this is just a wall of text.
example: Camera.CFrame = player.Character.Humanoid
See that’s the problem, I am having a ton of trouble correctly defining the players humanoid, it always results in error!
After testing the Roblox Player console shows that the way I defined it which should be correct is not.
Oh sorry, I was kind of ranting there, I’ll change what I was saying.
After the player teleports to the reserve server, it will remove the GUI (which it has done), then because it’s something I’ve programmed, it will change the player’s camera back to the default instead of reverting to the “parts” (or custom cameras) CFrame.
I want the player’s camera to be set to custom, which it has just fine, though it’s not finding the CFame so the camera is not going back to the default. (It’s just continuing the Camera Manipulation.)
Now currently I am getting the local Camera = workspace.CurrentCamera
I could instead use what i’ll name CameraA and get: local CameraA = workspace.Camera
I have no idea what it may do but it could use that as the problem.
Camera is a server thing. Meaning it will only change the servers camera and not the players. If you want to mess with the players cameras you need to do it through a local script.
Okay i get this, though (sadly another roadblock and i am dense)
local Players = game:GetService("Players")
local player = script:FindFirstAncestorOfClass("Player")
local ScreenGui = game.Players.LocalPlayer.PlayerGui.ScreenGui
local MenuMusic = game.SoundService["Distorted Reality Perception - Leon Riskin"]
local Camera = workspace.CurrentCamera
local Players = game:GetService("Players")
local isReserved = game.PrivateServerId ~= "" and game.PrivateServerOwnerId == 0
if isReserved == true then
print("reserved is true for ClientSide")
ScreenGui.Enabled = false
Camera.CameraType = Enum.CameraType.Custom
MenuMusic.Playing = false
end
LocalScript
it says i cannot call private servers Id in local script (obviously but i didnt know at the time), what should i call to verify? actually wait i just remembered i can use a remoteevent but that will take a while.
Okay so i’ve gotten it to use the events though its not waiting until the player is detected in the reserve.
Script:
--Variables and code for reserve server stuff
local MainMusic = game.SoundService["Distorted Reality Perception - Leon Riskin"]
local reserve = script.Parent.ScreenGui.PlayFrame.GameTypeButton1
local debounce = false
local ScreenGui = script.Parent.ScreenGui
reserve.MouseButton1Click:Connect(function()
print("starting reserve")
if debounce then return end
debounce = true
local ts = game:GetService("TeleportService")
local access = ts:ReserveServer(game.PlaceId)
ts:TeleportToPrivateServer(game.PlaceId, access, game.Players:GetPlayers())
warn("Teleporting everybody...")
task.wait(5)
debounce = false
end)
local Players = game:GetService("Players")
local player = script:FindFirstAncestorOfClass("Player")
local Camera = workspace.CurrentCamera
local Players = game:GetService("Players")
local isReserved = game.PrivateServerId ~= "" and game.PrivateServerOwnerId == 0
if isReserved == true then
game.ReplicatedStorage.OnClientEvent:Connect(function(player)
print("reserved is true for ServerSide")
end)
end
LocalScript:
local Players = game:GetService("Players")
local player = script:FindFirstAncestorOfClass("Player")
local ScreenGui = game.Players.LocalPlayer.PlayerGui.ScreenGui
local MenuMusic = game.SoundService["Distorted Reality Perception - Leon Riskin"]
local Camera = workspace.CurrentCamera
local Players = game:GetService("Players")
local reserve = game.Players.LocalPlayer.PlayerGui.ScreenGui.PlayFrame.GameTypeButton1
reserve.MouseButton1Click:Connect(function()
game.ReplicatedStorage.RemoteEvent:FireServer()
print("reserved is true for ClientSide")
ScreenGui.Enabled = false
Camera.CameraType = Enum.CameraType.Custom
MenuMusic.Playing = false
end)
also sorry for dragging this on, if you can’t help no worries.
Then, check if it’s reserved. If it is, fire to the client.
Server Script
--Variables and code for reserve server stuff
local MainMusic = game.SoundService["Distorted Reality Perception - Leon Riskin"]
local reserve = script.Parent.ScreenGui.PlayFrame.GameTypeButton1
local debounce = false
local ScreenGui = script.Parent.ScreenGui
reserve.MouseButton1Click:Connect(function()
print("starting reserve")
if debounce then return end
debounce = true
local ts = game:GetService("TeleportService")
local access = ts:ReserveServer(game.PlaceId)
ts:TeleportToPrivateServer(game.PlaceId, access, game.Players:GetPlayers())
warn("Teleporting everybody...")
task.wait(5)
debounce = false
end)
local Players = game:GetService("Players")
local player = script:FindFirstAncestorOfClass("Player")
local Camera = workspace.CurrentCamera
local Players = game:GetService("Players")
local isReserved = game.PrivateServerId ~= "" and game.PrivateServerOwnerId == 0
game.Players.PlayerAdded:Connect(function(player)
if isReserved == true then
game.ReplicatedStorage.RemoteEvent:FireClient(player) -- You can fire to the client that it is reserved.
end
end)
Okay heres the client, I think its something on here because Server is fine.
local Players = game:GetService("Players")
local player = script:FindFirstAncestorOfClass("Player")
local ScreenGui = game.Players.LocalPlayer.PlayerGui.ScreenGui
local MenuMusic = game.SoundService["Distorted Reality Perception - Leon Riskin"]
local Camera = workspace.CurrentCamera
local Players = game:GetService("Players")
local reserve = game.Players.LocalPlayer.PlayerGui.ScreenGui.PlayFrame.GameTypeButton1
reserve.MouseButton1Click:Connect(function(player)
game:GetService("Players").PlayerAdded:Connect(function(player)
game.ReplicatedStorage.RemoteEvent:FireServer()
print("reserved is true for ClientSide")
ScreenGui.Enabled = false
Camera.CameraType = Enum.CameraType.Custom
MenuMusic.Playing = false
end)
end)
ill move this to another post because its somewhat off topic now