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

[REPOST] How can I give low-gravity to a specific team?

Asked by 5 years ago

Disclaimer: I am reposting this because I originally posted this question WAAAAY too late at night so nobody noticed it.

--------------------------------------------------------------------------------------------------------------------------------I want to make a game mode where when you join the Players Team, you have low gravity. I also can't change gravity in the workspace because I don't want the people who die to be able to jump still.

I tried this but...


local Playing = game.Teams.Players if game.Players.LocalPlayer.Team == Playing then game.Players.LocalPlayer.JumpForce = 34 end

... it doen't work /:

1 answer

Log in to vote
-2
Answered by 5 years ago

First, you should make a Script, in ServerScriptService to let the client know which team is playing.

Teams = {
    game.Teams.RedTeam;
    game.Teams.BlueTeam;
};

-- game.ReplicatedStorage.CurrentTeam is an ObjectValue

while wait(60 * 5) do -- 5 minutes per round
    if game.ReplicatedStorage.CurrentTeam.Value == Teams[1] then
        game.ReplicatedStorage.CurrentTeam.Value = Teams[2]
    else
        game.ReplicatedStorage.CurrentTeam.Value = Teams[1]
    end
end

The client, anywhere but ServerScriptService, a LocalScript:

local MyTeam = game.Players.LocalPlayer.TeamColor

game.ReplicatedStorage.CurrentTeam.Changed:connect(function()
    if game.ReplicatedStorage.CurrentTeam.TeamColor ~= MyTeam then
        workspace.Gravity = 216 -- default gravity
    else
        workspace.Gravity = 50 -- low gravity
    end
end

Note: JumpForce does not exist, however, JumpPower does. Player's character properties are found in: game.Players.PlayerNameHere.Character.Humanoid

Hope I helped!

0
Can I do game.Players.LocalPlayer.Character.Humanoid? zboi082007 270 — 5y
Ad

Answer this question