✓ Accepted answer
Hello Gingerely
Thanks for the question
Basically, because I guess you're using a server script, inside of a part, you can just do everything here, as the serverscript is safe, and the client can not edit this, meaining you will not need to fire the server.
RemoteEvents, allow the server and the Client to interact / communicate.
Since you're already using a serverscript, you can do this
local debounce = false
script.Parent.Touched:Connect(function(hit)
if debounce == false then
debounce = true
if hit.Parent:FindFirstChild("Humanoid") then
local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
player.leaderstats["Currency2"].Value = player.leaderstats["Currency1"].Value * 2
player["Currency1"].Value = 0
wait(2)
debounce = false
end
end
end)
12 comments
when i make an OnServerEvent function, it does not do anything...
Did you change it to a local script?
yes
the onserverevent function is in server script service
make sure you do game:GetService('ReplicatedStorage').Events:FindFirstChild('Sell').OnServerEvent:Connect(function(Player)
not working
What do the errors say?
nothing, i just did print("Working") after that and it wont print
Make sure you have all your events in the right location, and make sure your server scripts are in serverscriptservice and your local script is in StarterGUI
yep... not workign
yep... not workign
Make sure your part is anchored.