People Abusing Shop System In my game

I made this shop system, and whenever people step into the shop area it a gui pops up, so the problem is people abuse this system and have the shop gui pop up then just walk out of the shop and then buy the item

I tried making it so when the player enters the shop it removes their walkspeed and jump but im really not sure how to add it.

Any help would be awesome, since im not very good at lua

Here the lua (The lua makes the GUI pop up)

local debounce = false 

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

script.Parent.Touched:Connect(function(hit)	

	if debounce then return end
	debounce = true

	local player = game.Players:GetPlayerFromCharacter(hit.Parent)

	if player then
		remote:FireClient(player)
	end

	wait(3)
	debounce = false

end)
2 Likes
local debounce = false 

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

script.Parent.Touched:Connect(function(hit)	

	if debounce then return end
	debounce = true

	local player = game.Players:GetPlayerFromCharacter(hit.Parent)

	if player then
		local character = player.Character
		if character then
			local humanoid = character:FindFirstChildOfClass("Humanoid")
			if humanoid then
				humanoid.WalkSpeed = 0
				humanoid.JumpPower = 0
				remote:FireClient(player)
				task.delay(3, function()
					humanoid.WalkSpeed = 16
					humanoid.JumpPower = 50
				end)
			end
		end
	end

	task.wait(3)
	debounce = false

end)

How long should they not be able to move for? Currently the time is set to 3 seconds, feel free to alter that by changing the first argument to task.delay().

2 Likes

You can try just making the shop screen full screen so then they can’t see where they’re going, and would stop walking out of the shop with it open. Alternatively you can detect keyboard inputs and have the UI automatically close when they are detected (to detect attempts to move).

1 Like

can I ask how it is abused? why are you needing the players to stand still while viewing shop?

1 Like

So I suppose your script is a Server Script and you want players to stop moving when they step in a certain part right? I saw you made something like

remote:FireClient(player)

So a local script will receive the remote event’s signal and do its function like pop up gui. I suggest you can disable the player’s movement along with the other functions

You can do this:

local LocalPlr = game:GetService("Players").LocalPlayer
local PlrControl = require(LocalPlr.PlayerScripts.PlayerModule):GetControls()

PlrControl:Disable()

Therefore, the player can’t move while stepping in the part.
When the player press a “X” button in the Shop Ui, then Enable it’s control and disable the Gui.

1 Like

Thats where my problem comes in, i dont know how to connect it to the exit button for the shop GUI. heres the close shop button for the gui if it helps

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


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

script.Parent.Activated:Connect(function()
	gui.Enabled = false
	
end)

remote.OnClientEvent:Connect(function()
	gui.Enabled = true
	
end)


1 Like

You should just do script.Parent.TouchEnded:Connect(function() and close the GUI when that event gets fired.

If the GUI starts to get glitchly like constantly opening and closing, extend the hitbox for detecting if the player touched it to be taller than the player and only check if the HumanoidRootPart touched it.

HumanoidRootPart because it doesn’t move when animations play and is always in the center of the player.

1 Like

You can use something along the lines of TouchEnded, to get when the player leaves the queue and remove the UI from their screen!

https://developer.roblox.com/en-us/api-reference/event/BasePart/TouchEnded

1 Like

I have a question. How do you do TouchEnded when you can’t move? Since I think @NavenTheNoob doesn’t want the players to move when the Shop Gui Pops Up.

1 Like

Just make the players able to move? Or add an exit button and/or keybind.

So i saw that most people like go to the shop, get the gui on their screen. then walk somewhere else and buy the item. I need people to stay in the shop building. Also the GUI is half transparent so they would still see where their going.

So do you mean the players are able to move with the gui visible?

heres an example
robloxapp-20220314-2354312.wmv (2.3 MB)

Could you use other recording software? I’m afraid that I’m not able to download the file sorry.

(Edit: For example, streamable or gyazo)

I used the roblox recorder, dont have any other software at the moment. sorry

is there a way to make the video embedded though?

Would you mind giving YouTube Links? Or describe the situation with words + images. Sorry for the inconvenience caused.

Use online converter to convert file to MP4. Then upload and it will auto embed.

its alright, i can make a youtube video for it really quickly

alright ill do that, thanks alot!