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

Model spawning script works in Studio but not in Client?

Asked by 5 years ago
Edited 5 years ago

It works in studio but not in Client. It's FE Disabled because the bogies will break if FE Enabled, do I need to use remote functions? If so how?

Frame = script.Parent.Parent
C70 = Frame:WaitForChild("Set1")
Player = game.Players.LocalPlayer
GUI = Player.PlayerGui.MainMenuGui
train = game.ReplicatedStorage.C70Freight
Camera = workspace.CurrentCamera
DriveFrame = GUI.Screen.DriveFrame
Spawning = GUI.Screen.Spawning
Character = game.Players.LocalPlayer.Character

function C70Clicked()
    if workspace:IsRegion3Empty(Region3.new(Vector3.new(467.505, 6.548, -3076.283), Vector3.new(1152.544, 6.559, -3298.865))) then
        DriveFrame.Visible = false
        Spawning.Visible = true
        Spawning.Text = "Spawning..."
        wait(0.01)
        local clone = train:Clone()
        clone.Parent = workspace
        clone:MakeJoints()
        clone.Bogies.SD_Bogie2:MakeJoints()
        clone.Bogies.SD_Bogie:MakeJoints()
        wait(1)
        Character.HumanoidRootPart.CFrame = CFrame.new(610.265, 6.551, -3143.202)
        Spawning.Visible = false
        Player.CameraMode = "Classic"
        Camera.CameraType = "Custom"
        Camera.FieldOfView = 80
        wait(1)
        GUI.Screen.IntroMusic:Stop()
        script.Disabled = true
    else
        DriveFrame.Visible = false
        Spawning.Visible = true
        Spawning.Text = "Spawning..."
        wait(1)
        Spawning.Text = "Spawn Occupied! Please wait."
        wait(1)
        DriveFrame.Visible = true
        Spawning.Visible = false
    end
end


C70.MouseButton1Click:connect(C70Clicked)


0
Do you get any errors in the dev console? yyyyyy09 246 — 5y
0
Any ideas? CarlPlandog 20 — 5y
0
It's quite possible you could have incorrect spelling of "Spawning"? yyyyyy09 246 — 5y
0
Yeah but it works in studio so I dont see how CarlPlandog 20 — 5y

Answer this question