People Abusing Shop System In my game

No problem, I recommend this site: WMV to MP4 | CloudConvert

Im using that one right now. XD

1 Like

So do you want to disable the player’s movement until they have closed the ui?

1 Like

yeah thats basically all i need, sorry for all the inconvenience!!

1 Like

Here, I gave you a way to do that. You may refer to it. If it works, remember to mark it as Solved so other developers can refer to it in the future!

1 Like

I’m not really sure how that works, or how i can put that into the script

1 Like

just do Player.Character.PrimaryPart.Anchored = true and when they close the shop in un anchored the player

How can I put that into my code, im not sure how to do that kinda of lua

local gui = script.Parent.Parent.Parent
gui.Enabled = false


local remote = game:GetService("ReplicatedStorage").ShopRemotes.OpenShop

script.Parent.Activated:Connect(function()
	gui.Enabled = false
	Player.Character.PrimaryPart.Anchored = false
end)

remote.OnClientEvent:Connect(function()
	gui.Enabled = true
	Player.Character.PrimaryPart.Anchored = true
end)

In your script, there is a touch event like this.
Just add a line right there so the player’s HRP will be anchored.

local debounce = false 

local remote = game:GetService("ReplicatedStorage").ShopRemotes.OpenShop

script.Parent.Touched:Connect(function(hit)	
     
	if debounce then return end
	debounce = true
        
        if hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
	    local player = game.Players:GetPlayerFromCharacter(hit.Parent)

	    if player then
                hit.Parent:FindFirstChild("HumanoidRootPart").Anchored = true -- Here will anchor the player, so he can't move        
	  	        remote:FireClient(player) --You fired client here.
	        end
        end
	wait(3)
	debounce = false

end)

In client, there should be a local script which receives the signal from server since you fired a signal through Remote Event.

REMOTE.OnClientEvent:Connect(function()
    --pop up ui
end)

Then when you want to close the ui

BUTTON.MouseButton1Click:Connect(function()
    REMOTE:FireServer()
end)

Then, a server should receive the signal and unanchor the player.

REMOTE.OnServerEvent:Connect(function(player)
    player.Character:FindFirstChild("HumanoidRootPart").Anchored = false
end)

(EDIT: I did changes to the format so you can have a better looking)

1 Like

This is a good way to do it. My way is kinda fast and lazy this is the right way imo @NavenTheNoob

However, if an Exploiter tries to make changes like make his HRP unanchored. It will still “Abuse” your shop system.

Wait so do i basically make a remote and just connect it to this, or is that not needed?

Sorry I don’t understand your meaning. Mind elaborate?

So you say “In client, there should be a local script which receives the signal from server since you fired a signal”

So i put a local script in the client, and make a remote event?

Edit: I’m very confused, so sorry!

@AMX13F3AM

Oh wait, so this script isn’t in server script. Its in the part you step in

The remote event should be placed under ReplicatedStorage as both Server and Client can access to it. The Touch Script should be placed under the part or in ServerScriptService depends your working style.
The local script should be placed under a screen gui because you want a Ui to pop up upon receiving signal.

Okay so i tried this, and failed. Is there maybe an easier way?? also the close button is detected on Text Button

Why not have a invisible part outside ate the door of the shop so when they exit the shop and spawn on that invisible part it will detect a player and check to see if the shop ui is visible and if it is then it will set the visibility to false or you can also use the door instead of the part so when they touch the door the ui visibility will be false