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

When A Player Fires A Remote Event The Others Get The Notifications? [Solved Fixed]

Asked by 3 years ago
Edited 3 years ago

So I Am making A Simulator And I Am Making The Pop Up Effect Using Remote Events When A Players Swings The Other Player Gets His Points Cause Of Remote Events Can Anyone Fix This For Me?

Normal Script For Sword

local abbreviations = {
    N = 10^30;
    O = 10^27;
    Sp = 10^24;
    Sx = 10^21;
    Qn = 10^18;
    Qd = 10^15;
    T = 10^12;
    B = 10^9;
    M = 10^6;
    K = 10^3
}
function abbreviateNums(number)


    local abbreviatedNum = number
    local abbreviationChosen = 0


    for abbreviation, num in pairs(abbreviations) do

        if number >= num and num > abbreviationChosen then

            local shortNum = number / num
            local intNum = math.floor(shortNum)

            abbreviatedNum = tostring(intNum) .. abbreviation
            abbreviationChosen = num
        end
    end

    return abbreviatedNum
end

local Addamount = 1000

local db = false
script.Parent.Activated:Connect(function()
    if not db then
        local amount = abbreviateNums(Addamount)
        game.ReplicatedStorage.OnActivate:FireAllClients(amount)
        db = true
        wait(0.5)
        db = false
    end
end)

game.ReplicatedStorage.SendData.OnServerEvent:Connect(function(plr)
    plr.leaderstats.Swing.Value = plr.leaderstats.Swing.Value + Addamount
end)

Local Script For Gui

game.ReplicatedStorage.OnActivate.OnClientEvent:Connect(function(amount)
    local RandomPositionTable = {
        UDim2.new(0.3,0,0.7,0),
        UDim2.new(0.4,0,0.6,0),
        UDim2.new(0.2,0,0.8,0),
        UDim2.new(0.8,0,0.2,0),
        UDim2.new(0.6,0,0.4,0),
        UDim2.new(0.7,0,0.3,0)
    }
    game.ReplicatedStorage.Sound:Play()
    wait(0.3)
    game.ReplicatedStorage.SendData:FireServer()
    script.Parent.Text = "+"..amount
    script.Parent.Position = RandomPositionTable[math.random(1,#RandomPositionTable)]
    script.Parent.Visible = true
    script.Parent:TweenPosition(script.Parent.Position - UDim2.new(0,0,0.1,0),"Out", "Sine", 0.5)
    wait(0.5)
    script.Parent.Visible = false
end)
0
Do you want the pop up only appears on the player that swing the sword? 12Strings 0 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

The Answer Was: Just See Roblox Youtube Tutorials Lol

Ad

Answer this question