Remotevent not firing

My folowing script is a local script which checks if a player pressed a button and sends a remote event. For some reason its not firing the remote event. I have printed and it is printing whne the button is pressed any help will be appreaciated.

for _, buttons in pairs(frame.ScrollingFrame:GetChildren()) do
if buttons:IsA(“TextButton”) then
buttons.MouseButton1Click:Connect(function()

  	if buttons.Donated.Value == 100 then
  		if game.Players.LocalPlayer.Stands.Donated100 == true then
  			frame.Visible = false
  			game.ReplicatedStorage.D100DonatedToServer:FireServer(game.Players.LocalPlayer, buttons.Donated.Value)
  		end
  	end
  	if buttons.Donated.Value == 1000 then
  		if game.Players.LocalPlayer.Stands.Donated1000 == true then
  			game.ReplicatedStorage.D100DonatedToServer:FireServer(game.Players.LocalPlayer, buttons.Donated.Value)
  		end
  	end
  	
  	if buttons.Donated.Value == 10000 then
  		if game.Players.LocalPlayer.Stands.Donated10000 == true then
  			game.ReplicatedStorage.D100DonatedToServer:FireServer(game.Players.LocalPlayer, buttons.Donated.Value)
  		end
  	end
  	
  	if buttons.Donated.Value == 100000 then
  		if game.Players.LocalPlayer.Stands.Donated100K == true then
  			game.ReplicatedStorage.D100DonatedToServer:FireServer(game.Players.LocalPlayer, buttons.Donated.Value)
  		end
  	end
  	
  	if buttons.Donated.Value == 1000000 then
  		if game.Players.LocalPlayer.Stands.Donated1M == true then
  			game.ReplicatedStorage.D100DonatedToServer:FireServer(game.Players.LocalPlayer, buttons.Donated.Value)
  		end
  	end
  end)

end
end

1 Like

Hey! I have improved and optimized much of your script this may affect the remote event and the main reason why I could not make a FireRemote

local donationMap = {
    [100] = "Donated100",
    [1000] = "Donated1000",
    [10000] = "Donated10000",
    [100000] = "Donated100K",
    [1000000] = "Donated1M"
}

for _, buttons in pairs(frame.ScrollingFrame:GetChildren()) do
    if buttons:IsA("TextButton") then
        buttons.MouseButton1Click:Connect(function()
            local donatedValue = buttons.Donated.Value
            local playerProperty = donationMap[donatedValue]

            if playerProperty and game.Players.LocalPlayer.Stands[playerProperty] == true then
                frame.Visible = false
                game.ReplicatedStorage.D100DonatedToServer:FireServer(game.Players.LocalPlayer, donatedValue)
            end
        end)
    end
end

If this does not work I recommend first checking that there is no error in the console and then make sure that it is detecting the button.

1 Like

Tysm you fixed it. Thanks for your help!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.