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

FireAllClients doesn't effect all clients but only the one that called the function (any fix?)

Asked by 3 years ago
local db = false
local Prize = script.Parent.Parent.Info.Prize

script.Parent.Touched:Connect(function(hit)
    if db == false then
        db = true
        if hit.Parent:FindFirstChild("Humanoid") then
            print("Found a player")
            local player = game.Players:GetPlayerFromCharacter(hit.Parent)
            player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + Prize.Value
            player.DoingObby.Value = false
            game.Workspace.Sounds.Success_Sound:Play()
            game.ReplicatedStorage.ObbyMapRewardNotification.WinNotification:FireAllClients(Prize.Value,script.Parent.Parent.Info.Prize.CurrencyName.Value, script.Parent.Parent.Name)
            hit.Parent.HumanoidRootPart.CFrame = CFrame.new(game.Workspace.Spawn.SpawnPoint.SpawnLocation.Position + Vector3.new(0,7,0))
            game.ReplicatedStorage.ObbyMapRewardNotification.RewardNotification:FireClient(player,Prize.Value,script.Parent.Parent.Info.Prize.CurrencyName.Value, script.Parent.Parent.Name)
            game.ReplicatedStorage.ObbyLockEvents.Lock:FireClient(player)
            wait(0.5)
            db = false
        end
    end
end)
0
If you don't know where the code is, it is " game.ReplicatedStorage.ObbyMapRewardNotification.WinNotification:FireAllClients(Prize.Value,script.Parent.Parent.Info.Prize.CurrencyName.Value, script.Parent.Parent.Name)" Philipceo90 18 — 3y
0
Error must be in local script, as FireAllClients cannot just affect one client. Show us your local script. sleazel 1287 — 3y

Answer this question