script crashes game when executed?
Asked by
6 years ago Edited 6 years ago
this script is for making a gui appear, music play, and camera change when you touch a part.
that part works, but i think it works too many times as when you touch the part, it appears for a second, then crashes the game/studio..
i think the problem is the debounce, and it is not working correctly. i get no errors from this script either, but any help is really appreciated.
02 | function onTouched(hit) |
03 | local player = game.Players:GetPlayerFromCharacter(hit.Parent) |
04 | if player and debounce = = false then |
06 | player:WaitForChild( "PlayerGui" ).Credits.Frame.Visible = true |
10 | local Camera = game.workspace.CurrentCamera |
11 | workspace.ramp.Touched:Connect(onTouched) |
13 | Camera.CameraType = "Scriptable" |
14 | Camera.CFrame = game.workspace.CamPart 2. CFrame |
20 | STAR = game.SoundService.STAR |
21 | workspace.ramp.Touched:connect( function (hit) |
22 | if not hit.Parent:FindFirstChild( "Humanoid" ) then return end |
26 | workspace.ramp.Touched:Connect(onTouched) |
28 | game.Workspace.ramp.CanCollide = false |
29 | game.Workspace.mainwall.CanCollide = true |
EDIT: Shortened my plea for help