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

My spawning system works in studio but not the client?

Asked by 5 years ago

It works in studio, but not the client.. I just don't get it.

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
Well in order to spawn something client sided, I would recommend looking into Filtering Enabled: https://wiki.roblox.com/index.php?title=API:Class/Workspace/FilteringEnabled and Remote Events: https://wiki.roblox.com/index.php?title=API:Class/RemoteEvent yoshi8080 445 — 5y

Answer this question