Hi, I did a script where a person clicks on a "Give all points" button, which makes it so everyone gets a menu popped up that makes them click on a confirm button to receive 25 points. However, some players are not getting those points.

Here are the scripts: Give all points button script:

script.Parent.MouseButton1Click:Connect(function()
	if game.ReplicatedStorage.PaidBlueMiles.Value == false then
    	game.ReplicatedStorage.AddPoints:FireServer(false)--u need to tell the server to do something, a client cant tell other clients anything, it have to go through the server
	elseif game.ReplicatedStorage.PaidBlueMiles.Value == true then
		print("Blue Miles are already paid")
		script.Parent.Text = "Blue Miles have already been paid!"
		wait(2)
		script.Parent.Text = "Pay out 25 Blue Miles"
	end
end)

Server script:

game.ReplicatedStorage.AddPoints.OnServerEvent:Connect(function(player,value)
    if value == false then
        game.ReplicatedStorage.AddPoints:FireAllClients()
        game.ReplicatedStorage.PaidBlueMiles.Value = true
    elseif value == true then
        player.leaderstats.Points.Value = player.leaderstats.Points.Value + 25    
    end
end)

Open menu script:

game.ReplicatedStorage.AddPoints.OnClientEvent:Connect(function()
    script.Parent:TweenPosition(UDim2.new(0,0,0.481,0))
end)

When you click on confirm script:

local secondMenu = script.Parent.Parent.Parent.SecondMenu
local firstMenu = script.Parent.Parent
local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
    for i,v in pairs(firstMenu:GetChildren()) do
        v.Visible = false
    end
    secondMenu.Loading.Visible = true
    wait(2)
    secondMenu.Loading.Visible = false
    for i,v in pairs(secondMenu:GetChildren()) do
        if v.Name ~= "Loading" then
            v.Visible = true
        end
    end
    game.ReplicatedStorage.AddPoints:FireServer(true)
    wait(2)
    script.Parent.Parent.Parent:TweenPosition(UDim2.new(-0.4,0,0.481,0))
end)

I don't see what I'm doing wrong. Please help!

2 comments

0

What is the confirm script versus the give all points button script? Maybe the difference between the two and how they are used could be the issue?

0

Basically, the give all points button script actually sends the UI to all players in the server to get the points. The confirm script is so when the UI appears, the player can click on confirm to actually get the points. I don't see how that would be a problem.