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

Making a text label saying Start and then teleporting the player to the part?

Asked by 6 years ago
Edited 6 years ago

So I am learning some about scripting and I was trying to make a minigame just for fun and I tried alot of things and they all don't work can someone help me?

Starting = game.StarterGui.ScreenGui:GetChildren()

for i, v in pairs (Starting) do
    v.Text = "Starting Game" --Changing the Text label to say starting game
end


player = game.Players.LocalPlayer
pad = game.Workspace.Part

function makeHumanoidRootPartMove()
for i = 50, 2.6 do
    player.Character.HumanoidRootPart.CFrame = CFrame.new(player.CFrame.X + i, player.CFrame.Y + i, player.CFrame.Z)

  end
 end

makeHumanoidRootPartMove()
0
Lines 1-5... could you explain to me what YOU are doing? :| Pojoto 329 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

StarterGui and PlayerGui; Not the Same

Some beginners may find this to be a quick way to change a Gui for all players. Unfortunately, it's not that simple. StarterGui is basically what PlayerGui clones from when you respawn. That means, any changes you make to objects in StarterGui will not show until you respawn.

--Common Mistakes

To fix your problem, you'd get the children from the PlayerGui.

local player = game.Players.LocalPlayer -- Remember to use local variables!
local playerGui = player:WaitForChild("PlayerGui")
local Starting = playerGui:WaitForChild("ScreenGui"):GetChildren()
local char = player.Character or player.CharacterAdded:Wait()

for i, v in pairs(Starting) do
    v.Text = "Starting Game"
end

local pad = game.Workspace.Part

local function makeHumanoidRootPartMove()
    for i = 50, 2.5, -.5 do -- count backwards with a negative number 
        player.Character:SetPrimaryPartCFrame(
            CFrame.new(
                char:GetPrimaryPartCFrame().X + i, 
                char:GetPrimaryPartCFrame().Y + i, 
                char:GetPrimaryPartCFrame().Z
            )
        )
    end
end

makeHumanoidRootPartMove()

For next time, make sure to specify what is wrong, and tell us some information such as script location and script type, as well as sharing output errors if there are any,

0
INCAPAZ STRIKES AGAIN!!!!!!!!1 greatneil80 2647 — 6y
0
INCAPAZ STRIKES AGAIN!!!!!!!!1 greatneil80 2647 — 6y
Ad

Answer this question