This doesnt work?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    To make this script work
  2. What is the issue? Include screenshots / videos if possible!
    Its either a visual glitch or the remote event wont send the data to the server
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Multiple things and none work
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
ReplicatedStorage = game:GetService("ReplicatedStorage")

DataSender1 = ReplicatedStorage:WaitForChild("DataSender1")

DataSender1.OnServerEvent:Connect(function(Player, Data)
	Data.Value = Data.Value + 1
-- Client Script
GUI = script.Parent

Player = game:GetService("Players").LocalPlayer
ReplicatedStorage = game:GetService("ReplicatedStorage")

Clicker1 = GUI:WaitForChild("Clicker1")
Rebirther1 = GUI:WaitForChild("Rebirther1")

PlayerStat1 = Player:WaitForChild("leaderstats").Clicks
PlayerStat2 = Player:WaitForChild("leaderstats").Rebirths

DataSender1 = ReplicatedStorage:WaitForChild("DataSender1")

Clicker1.MouseButton1Click:Connect(function()
	DataSender1:FireServer(PlayerStat1)
end)

end)

Theres so much here that is incorrect that my head is going to explode. you dont even end your server script function >.<

Please take another look over, also go more in depth on what your issue is and what youre trying to achieve.

1 Like

You can’t fire an event from the server to the server but you seem to do it:

EDIT: wait are you puting in one perfomated text the two script?

thats part of his client script

so he is correct there

wait one second i pasted it wrong

ReplicatedStorage = game:GetService("ReplicatedStorage")

DataSender1 = ReplicatedStorage:WaitForChild("DataSender1")

DataSender1.OnServerEvent:Connect(function(Player, Data)
	Data.Value = Data.Value + 1
end)

uhh what? apparently, the scripts are supposed to +1 a players leaderstat by clicking a button, this should work and also the end was there but i pasted it wrong

Is this also pasted wrong? 2 end)'s to one function?

uhh yeah, bascially, there are no end errors, infact there are no errors when i click the button, it just doesnt work

Oh, heres a better well pasted script

GUI = script.Parent

Player = game:GetService("P").LocalPlayer
ReplicatedStorage = game:GetService("ReplicatedStorage")

Clicker1 = GUI:WaitForChild("Clicker1")
Rebirther1 = GUI:WaitForChild("Rebirther1")

PlayerStat1 = Player:WaitForChild("leaderstats").Clicks
PlayerStat2 = Player:WaitForChild("leaderstats").Rebirths

DataSender1 = ReplicatedStorage:WaitForChild("DataSender1")

Clicker1.MouseButton1Click:Connect(function()
	DataSender1:FireServer(PlayerStat1)
end)
ReplicatedStorage = game:GetService("ReplicatedStorage")

DataSender1 = ReplicatedStorage:WaitForChild("DataSender1")

DataSender1.OnServerEvent:Connect(function(Player, Data)
	Data.Value = Data.Value + 1
end)

I feel like this is pretty obvious. It should be Players, not P.

one second, okay so i tried that and it still didnt work

ReplicatedStorage = game:GetService("ReplicatedStorage")

DataSender1 = ReplicatedStorage:WaitForChild("DataSender1")

DataSender1.OnServerEvent:Connect(function(Player, Data)
	Data.Value = Data.Value + 1
end)
GUI = script.Parent

Player = game:GetService("Players").LocalPlayer
ReplicatedStorage = game:GetService("ReplicatedStorage")

Clicker1 = GUI:WaitForChild("Clicker1")
Rebirther1 = GUI:WaitForChild("Rebirther1")

PlayerStat1 = Player:WaitForChild("leaderstats").Clicks
PlayerStat2 = Player:WaitForChild("leaderstats").Rebirths

DataSender1 = ReplicatedStorage:WaitForChild("DataSender1")

Clicker1.MouseButton1Click:Connect(function()
	DataSender1:FireServer(PlayerStat1)
end)

Let me try importing this and getting it to work in a test game, I’ll try and fix it. Will edit this reply once I’ve tested it.

wait a second, ima check my other scripts for a second

@emilaltg oh
image
so it seems i accidentally copied DataSender1 and this is the reason it doesnt work

That makes sense. Probably the server is grabbing one DataSender and the client is grabbing another.

Mark your own comment as the solution by the way.

sorry for the mess, didnt know i cloned the remote event

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