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

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

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()

1 comment

0

Lines 1-5... could you explain to me what YOU are doing? :|

1 answer

✓ Accepted answer

#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,

2 comments

0

INCAPAZ STRIKES AGAIN!!!!!!!!1

0

INCAPAZ STRIKES AGAIN!!!!!!!!1

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