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

Why is this script not teleporting any player?

Asked by 5 years ago
Edited 5 years ago

I'm trying to make that the players will teleport when ChosenGamemode's text is "Free For All Was Chosen" or "Death Match Was Chosen" but it doesn't teleport any player and it doesn't change the text back to "Gamemode Was Chosen" and it doesn't disappear, It's because it doesn't make it through the player teleportation.

[Edit: I have no errors in output]

Script:

for i, players in pairs(game.Players:GetChildren()) do
    local PlrGui = players.PlayerGui
    local RoundSystem = PlrGui.RoundSystem
    local Frame = RoundSystem.ChosenGamemode
    local ChosenGamemode = Frame.ChosenGamemode

    local Target = CFrame.new(0, 50, 0)

    while Frame.Visible == true do
        wait(0.1)

        if ChosenGamemode.Text == "Free For All Was Chosen" then
            wait(4)

            -- Teleport Players

            players.Character.HumanoidRootPart.CFrame = Target + Vector3.new(0, i * 5, 0)

            ChosenGamemode.Text = "Gamemode Was Chosen"
            Frame.Visible = false
        end

        if ChosenGamemode.Text == "Death Match Was Chosen" then
            wait(4)

            -- Teleport Players

            players.Character.HumanoidRootPart.CFrame = Target + Vector3.new(0, i * 5, 0)

            ChosenGamemode.Text = "Gamemode Was Chosen"
            Frame.Visible = false
        end
    end
end

(This script is a local script and the script is kinda glitched because it's long)

I would really appreciate it if you help me, Plus I'll accept your answer and we both make reputation from that.

Thanks, MajinBluee

0
Why in a LocalScript? Use a ServerScript instead... SulaymanArafat 230 — 5y
0
Sorry, But this didn't help me. But thanks for being kind and helping me with my problem! MajinBluee 80 — 5y

1 answer

Log in to vote
0
Answered by
T1mes 230 Moderation Voter
5 years ago
Edited 5 years ago

You can't add Vector3s to CFrames on lines 17 and 28. You would have to do

Target*CFrame.new(0, i * 5, 0)

Hope this helps.

0
Sorry, But this didn't help me. But thanks for being kind and helping me with my problem! MajinBluee 80 — 5y
0
Not downvoting, but your statement is wrong. You can actually construct a CFrame by summing up a CFrame and a Vector3. http://wiki.roblox.com/index.php?title=CFrame#Operators SulaymanArafat 230 — 5y
Ad

Answer this question