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

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

Asked by 1 year ago

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

Log in to vote
0
Answered by
ryanzhzh 128
1 year ago

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.

0
Ok thanks! wDaerkfeX 37 — 1y
Ad

Answer this question