I have a simple circle part in the workspace, and I want it so whenever the player walks into it, it invokes my "SellPtns" remote function. However, I'm getting an error saying it can only be fired client side. This remote function basically just sells whatever is in the player's inventory in exchange for one coin, and both of those values live in a datastore.
So does this script in workspace run on server side? I'm not sure if I should be changing datastore values without using a remote of some kind, in fear of it causing exploit issues. But if it's running on the server, the client shouldn't be able to access the script anyway, right?
local Part = script.Parent --Get remote function from replicated storage local replicatedStorage = game:GetService("ReplicatedStorage") Part.Touched:Connect(function(HIT) local H = HIT.Parent:FindFirstChild("Humanoid") if H then local player = game.Players:GetPlayerFromCharacter(HIT.Parent) if player then local success success = replicatedStorage.RemoteFunctions.SellPtns:InvokeServer() if success then print ("Potions sold successfully") end end end end)
As you are using server script you don't need to call remotes. Remotes are used so a client can change something on a server or so the server can access some stuff that only client can. You shouldn't be worried about exploiters.