#Button not working

1 messages · Page 1 of 1 (latest)

dark plume
#

i want this button to be able to press and for the proximityprompt to not be able to see. it doesnt give me any errors. If you need more info please ask

local highlight = script.parent:WaitForChild("Highlight")
local prompt = button:WaitForChild("ProximityPrompt")

highlight.FillTransparency = 1
highlight.OutlineTransparency = 1

local ts = game:GetService("TweenService")

local fadeti = TweenInfo.new(0.4, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut)
local ti = TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut)

local tween1 = ts:Create(button, ti, CFrame.new(0, -0.05, 0))
local tween2 = ts:Create(button, ti, CFrame.new(0, 0, 0))

local fadein = ts:Create(highlight, fadeti, {OutlineTransparency = 0.5})
local fadeout = ts:Create(highlight, fadeti, {OutlineTransparency = 1})

local debounce = false

prompt.PromptShown:Connect(function()
    fadein:Play()
end)

prompt.PromptHidden:Connect(function()
    fadeout:Play()
end)

prompt.Triggered:Connect(function()
    if debounce == false then
        debounce = true
        prompt.Enabled = false
        tween1:Play()
        wait(0.2)
        tween2:Play()
        wait(1)
        debounce = false
        prompt.Enabled = true
        
        if debounce == true then return end
    end
end)```
drowsy gale
#

first of all about the function prompt triggered

#

preferable the db true return end

#

and what’s the problem exactly

dark plume
#

Well nothing is happening the tween for the button doesnt play and the higlight is always on

drowsy gale
#

you are scripting weird

dark plume
#

Now that you mention the debounce == true i see why it could be wrong

drowsy gale
#

why you don’t put the animation on a function

dark plume
drowsy gale
#

sad im on phone else i would explain you in details what you have to do

#

wait till tomorrow I will help you for sure

#

@dark plume also you did a big mistake

#

for the hightlight

#

the variable

#

script.parent dont exist

#

it’s script.Parent

#

tween service is not used well

#

do something like this : ts:Create(button, ti, {CFrame = button.CFrame * CFrame.new(0, -0.05, 0)})

#

debounce is not correct

#

do like I said earlier

#

like that : if debounce then return end

#

debounce alone mean debounce == true

dark plume
#

so i dont need the debounce == true?

jolly spokeBOT
#

studio** You are now Level 5! **studio

drowsy gale
#

use task.wait instead of wait()

drowsy gale
dark plume
#

okay

drowsy gale
#

do what I said then send me a screen shot I will tell you if there is more problems

#

imma help you even if I’m phone

dark plume
#

thanks man

#

i removed the debounce == true line, changed the tween goals and fixed where the highlight is located but it still doesnt move the button and no errors

#

ive removed everything except the button pressing and it still doesnt work i might just redo this

drowsy gale
#

why did you delete debounce

dark plume
#

just to see if it self was working

drowsy gale
#

and promptshown and hidden

dark plume
#

it didnt and it was because it was a local script

drowsy gale
dark plume
#

yeah i did

#

it didnt print anything

#

until i moved it to a normal script

drowsy gale
#

where did you put the print ?

dark plume
#

in the triggered function

drowsy gale
#

wait hold on

#

is this script in workspace

dark plume
#

yeah

drowsy gale
#

local script dont work in workspace

#

you need to do a server script

dark plume
#

i moved it to a normal script

drowsy gale
dark plume
#

server script*

#

yeah

#

it works but i just need to get a way to fade in and out the higlight

drowsy gale
#

for optimisation and management it’s preferable you put the script into serverscriptservice

dark plume
#

what if i need multiple of the buttons

#

like the model