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

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

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

✓ Accepted answer

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!

1 comment

0

Can I do game.Players.LocalPlayer.Character.Humanoid?

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