✓ Accepted answer
Put everything in a local script and use a RemoteEvent inside of ReplicatedStorage, also you can get the player by just doing
local plr = game:GetService("Players").LocalPlayer
local rs = game:GetService("ReplicatedStorage")
function click()
rs.ClickEvent:FireServer()
end
script.Parent.MouseButton1Click:connect(click)
And on a server script inside of ServerScriptService would be
local rs = game:GetService("ReplicatedStorage")
rs.ClickEvent.OnServerEvent:connect(function(player)
player.leaderstats.Clicks.Value = player.leaderstats.Clicks.Value + 1
end)
If you have any questions or if this does not work please let me know.
4 comments
Thanks! I will try that in a moment.
So just trying to being clear to myself, so now I do not put functions in local scripts and put them in ServerScriptService with a server script?
The functions can go in a local script, the server script can have the code I mentioned above.
So can I have many of these? And will FE affect my Developer Product script?