Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

(Solved) Why is my Gui only executing once? (ClickDetector)

I have this button where I click it, the server script goes and executes the code below. The thing is the GUI only pops up once and remains out of the screen. Anything stands out? There are no errors so I have no clue what's going on. The only other code I have attached to this is when the GUI pops up, you can click the X and it goes back down.

local Inventory
local Slots = game.Workspace.Map.SlotMachines.SlotMachine1
local SpinModule = require(game.ServerScriptService.ModuleScript)
script.Parent.MouseClick:Connect(function(player)
	local slotmachine = script.Parent.Parent.Parent.Parent
	local char = player.Character
	local Humanoid = player.Character.Humanoid
	if player.leaderstats.Chips.Value == 0 then
		player.PlayerGui.OutOfCash.Gradient:TweenPosition(
			UDim2.new(0.5, 0, 0.499, 0), --End Position
			"Out",
			"Sine", --Easing Style
			1, --Time in seconds
			false -- override any other tweens
		)
		print("Not enough chips!")
		return
end

2 comments

0

Maybe if you add a close button you can click on and the "Gui" disappears. That might work. If not try adding a "wait(amount)" after the tweenservice that makes the "Gui" pop up and after that "wait(amount)" add some lines of code that make the "Gui" disappear just like that. If what I said made no sense then sorry, i'm just trying to help here bud.

0

if you can, please make a video of the bug

2 answers

✓ Accepted answer

idk if this works, but i saw problems with your scripts

local Inventory
local Slots = game.Workspace.Map.SlotMachines.SlotMachine1
local SpinModule = require(game.ServerScriptService.ModuleScript)
script.Parent.MouseClick:Connect(function(player)
    	local slotmachine = script.Parent.Parent.Parent.Parent
	local char = player.Character
	local Humanoid = player.Character.Humanoid
    	if player.leaderstats.Chips.Value == 0 then
        	player.PlayerGui.OutOfCash.Gradient:TweenPosition(UDim2.new(UDim2.new(0.5, 0, 0.499, 0), "Out", "Sine", 1, false)
        	print("Not enough chips!")
        end
end

if it doesn't work then dm me on Blue Duck#9891

1 comment

0

also can you be as specific as you can? what's the goal of the script and what are you trying to do?

Sorry guys turns out it was because I enabled the Tweenservice on a server script, and tried to close it with a Localscript, all I had to do was change the LocalScript to a ServerScript, thanks for trying to answer with my horrible explanation.

1 comment

0

unaccept my answer

This discussion is preserved as it was. New answers, comments, and votes are closed.