I have a script here:
It plays like, 50 times when touching it.
Can it be done without using Region3 or Rays?
part.Teleport1Part.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then local thing = game.Players.LocalPlayer.PlayerGui.ScreenGui.TeleportBlackScreen thing.Visible = true repeat wait(0.1) thing.BackgroundTransparency = thing.BackgroundTransparency - 0.1 until thing.BackgroundTransparency <= 0 hit.Parent.Head.CFrame = part.Teleport1Position.CFrame repeat wait(1) thing.BackgroundTransparency = thing.BackgroundTransparency + 0.1 until thing.BackgroundTransparency >= 1 thing.Visible = false end end end)
you can use a debounce.
local deb = false part.Teleport1Part.Touched:connect(function(hit) if deb == false then deb = true if hit.Parent:FindFirstChild("Humanoid") then local thing = game.Players.LocalPlayer.PlayerGui.ScreenGui.TeleportBlackScreen thing.Visible = true repeat wait(0.1) thing.BackgroundTransparency = thing.BackgroundTransparency - 0.1 until thing.BackgroundTransparency <= 0 hit.Parent.Head.CFrame = part.Teleport1Position.CFrame repeat wait(1) thing.BackgroundTransparency = thing.BackgroundTransparency + 0.1 until thing.BackgroundTransparency >= 1 thing.Visible = false wait(1) -- You can enter here how many seconds you want it to wait for until deb = false deb = false end end end end)
if this doesn't work, then tell me
Use a debounce value, a value to make sure it doesn't spam the function when the function is playing.
debounce = 0 part.Teleport1Part.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then debounce = 1 local thing = game.Players.LocalPlayer.PlayerGui.ScreenGui.TeleportBlackScreen thing.Visible = true repeat wait(0.1) thing.BackgroundTransparency = thing.BackgroundTransparency - 0.1 until thing.BackgroundTransparency <= 0 hit.Parent.Head.CFrame = part.Teleport1Position.CFrame repeat wait(1) thing.BackgroundTransparency = thing.BackgroundTransparency + 0.1 until thing.BackgroundTransparency >= 1 thing.Visible = false debounce = 0 end end end)
This should slow the rate down, and also make sure it doesnt happen when it is already playing, make sure to use debounce values in functions like this.
If you need it to be slower, you add a wait() before it turns debounce to 0, increase the wait() the less you want it to fire.