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

I made this script, it works, but sometime its "buggy and glitchy". help?

heres the script I made local Part = script.Parent

Part.Touched:Connect(function(HIT)

local H = HIT.Parent:FindFirstChild("Humanoid")

if H then

local Player = game.Players:GetPlayerFromCharacter(HIT.Parent)

Player.PlayerGui.ScreenGui.Frame.Visible = true

Player.PlayerGui.ScreenGui.Frame.BackgroundTransparency = 1

wait(.1)

Player.PlayerGui.ScreenGui.Frame.BackgroundTransparency = .9

wait(.1)

Player.PlayerGui.ScreenGui.Frame.BackgroundTransparency = .8

wait(.1)

Player.PlayerGui.ScreenGui.Frame.BackgroundTransparency = .7

wait(.1)

Player.PlayerGui.ScreenGui.Frame.BackgroundTransparency = .6

wait(.1)

Player.PlayerGui.ScreenGui.Frame.BackgroundTransparency = .5

wait(.1)

Player.PlayerGui.ScreenGui.Frame.BackgroundTransparency = .4

wait(.1)

Player.PlayerGui.ScreenGui.Frame.BackgroundTransparency = .3

wait(.1)

Player.PlayerGui.ScreenGui.Frame.BackgroundTransparency = .2

wait(.1)

Player.PlayerGui.ScreenGui.Frame.BackgroundTransparency = .1

wait(.1)

Player.PlayerGui.ScreenGui.Frame.BackgroundTransparency = 0

wait(.1)

Player.PlayerGui.ScreenGui.Frame.BackgroundTransparency = .1

wait(.1)

Player.PlayerGui.ScreenGui.Frame.BackgroundTransparency = .2

wait(.1)

Player.PlayerGui.ScreenGui.Frame.BackgroundTransparency = .3

wait(.1)

Player.PlayerGui.ScreenGui.Frame.BackgroundTransparency = .4

wait(.1)

Player.PlayerGui.ScreenGui.Frame.BackgroundTransparency = .5

wait(.1)

Player.PlayerGui.ScreenGui.Frame.BackgroundTransparency = .6

wait(.1)

Player.PlayerGui.ScreenGui.Frame.BackgroundTransparency = .7

wait(.1)

Player.PlayerGui.ScreenGui.Frame.BackgroundTransparency = .8

wait(.1)

Player.PlayerGui.ScreenGui.Frame.BackgroundTransparency = .9

wait(.1)

Player.PlayerGui.ScreenGui.Frame.BackgroundTransparency = 1

wait(0.1)

end

end)

and theres the example: https://www.youtube.com/watch?v=q0ya-C17UCg&feature=youtu.be (at 0:16)

I think the game repeats the script many times on something if a player touches the part, or i dont know. How can I fix this?

2 comments

0

ur vid is not available

0

I Fixed it, sorry.

1 answer

✓ Accepted answer

You maybe need a debounce, it is used like that :

local debounce = false
local Part = script.Parent

Part.Touched:connect(function(HIT)
    if not debounce then debounce = true
			--add your code here
	    wait(3)--you can choose the time btw
	    debounce = false
    end
end)

3 comments

0

I didn't put the part when you check if the things who touch the part is an humanoid, I forgot ^^

0

how to make it?

0

it's in your script already it's : local H = "HIT.Parent:FindFirstChild(“Humanoid”) if H then" at the beginning

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