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

Can anyone help me for a world bosst script for a simulator?

Hi! I am currently creating a simulator and I have a problem with world boosts, I created two scripts: This is worldboost_client:

local Players = game:GetService("Players")
local player = Players.LocalPlayer

local playerGui = player:WaitForChild("PlayerGui")
local WorldBoost = playerGui:WaitForChild("WorldBoost")
local WorldBoostLabel = WorldBoost:WaitForChild("WorldBoostLabel")

WorldBoostLabel.Text = ("JUMP WORLD BOOST: x")..player.WorldBoost.Value

player.WorldBoost.Changed:Connect(function()
	WorldBoostLabel.Text = ("JUMP WORLD BOOST: x")..player.WorldBoost.Value
end)

this is main_worldboost:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")

local zonePlus = require(ReplicatedStorage.WorldBoosts.Zone)
local Worlds = workspace.Worlds

local function newPlayer(player)
	local worldBoost = Instance.new("NumberValue")
	worldBoost.Name = "WorldBoost"
	worldBoost.Value = .1
	worldBoost.Parent = player
	for i, world in pairs(Worlds:GetChildren()) do
		if (not world:IsA("BasePart")) then
			continue
		end
		
		local zone = zonePlus.new(world)
		
		zone.playerEntered:Connect(function(player)
			player.WorldBoost.Value = world.Boost.Value
		end)
		
		zone.playerExited:Connect(function(player)
			player.WorldBoost.Value = 0.1
		end)
	end
end

local function setupWorldBoosts()

	Players.PlayerAdded:Connect(newPlayer)
end

the problem is that when I change worlds, the textlabel that displays the multiplier does not change. I hope that someone could help me! Thanks in advance!

1 answer

complex

First off, call setupWorldBoosts. Sometimes people forget this, even me.

I don't know the code for the world boost, so that's it for now.

1 comment

0

Ok thanks!

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