Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
z_lm 9
3 years ago
Edited 3 years ago

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
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. Nitrolux200 62 — 3y
0
if you can, please make a video of the bug WINDOWS10XPRO 438 — 3y

2 answers

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

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

0
also can you be as specific as you can? what's the goal of the script and what are you trying to do? WINDOWS10XPRO 438 — 3y
Ad
Log in to vote
0
Answered by
z_lm 9
3 years ago

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.

0
unaccept my answer WINDOWS10XPRO 438 — 3y

Answer this question