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

how to fix glitchiness in the starter character script?

when i get to the part after "wait(1)". the audio duplicates, the camera glitches, and it does not detect if the animation stops. script:

--here
local camera = game.Workspace.CurrentCamera
local cam1 = game.Workspace.cam1
local cam2 = game.Workspace.cam2
local replicatedStorage = game:GetService("ReplicatedStorage")
local Run = game:GetService("RunService")
local workSpace = game:GetService("Workspace")

local player = game.Players.LocalPlayer
local loading = script:WaitForChild("Value")
local camera = game.Workspace.CurrentCamera
local sound1 = script["car-pass-by-9111"]
local val = script:WaitForChild("onsound1")
local val2 = script:WaitForChild("cam3")
local sound2 = script["car-pass-by-9111"]
local sound3 = game.Workspace.EPIC["Ferrari California2"].race
local TweenService = game:GetService("TweenService")
local part1 = game.Workspace.EPIC["Ferrari California2"]
local gual = game.Workspace.gual	
local DANCE1 = game.Workspace.Dummy.Animation:WaitForChild("DANCE1")
local DANCE2 = game.Workspace.Dummy.Animation:WaitForChild("DANCE2")
local humanoid = game.Workspace.Dummy.Humanoid
local dance = workspace.Dummy.Humanoid:LoadAnimation(DANCE1)
local dance2 = workspace.Dummy.Humanoid:LoadAnimation(DANCE2)
local value = workspace.Dummy.Value
local tp = game.Workspace.tp
local part2 = game.Workspace.epic
local car1 = game.Workspace["Ferrari California"]

game:GetService("ReplicatedFirst"):RemoveDefaultLoadingScreen()

local TweenService = game:GetService("TweenService")


local info = TweenInfo.new(
	4, -- Time animating
	Enum.EasingStyle.Linear, -- EasingStyle
	Enum.EasingDirection.Out, -- EasingDirection
	0, -- Repitions
	false, -- Reverse post tween?
	0 -- Delay time
)

local goal = {

	-- HERE
	Position = game.Workspace.gual.Position

}

local tween1 = TweenService:Create(part1, info, goal)


wait(0.1)
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = workspace.cam1.CFrame
wait(0.5)
sound1:Play()
tween1:Play()
wait(2.5)
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = workspace.cam2.CFrame
sound2:Play()
wait(0.5)
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = workspace.CAM3.CFrame
sound2:Play()
wait(1)
script:WaitForChild("ik ik"):Play()
dance:Play()
repeat
	wait(0.1)
	camera.CameraType = Enum.CameraType.Scriptable
	camera.CFrame = workspace.Dummy.Head.CFrame
until script.Value == true



dance.Stopped:Connect(function()
	dance2:Play()
	game.Workspace.Dummy.HumanoidRootPart.CFrame = workspace.tp.CFrame
	script:WaitForChild("huh..?"):Play()
end)

game.Workspace["Ferrari California"].Touched:Connect(function(hit)
	if hit:FindFirstChild(humanoid) then
		script:WaitForChild("scream"):Play()
	end
end)

idk how to upload a video tho

1 answer

First of all instead of waiting you can use the .Completed function.

example:

local TweenService = game:GetService("TweenService")

local my_tween = TweenService:Create(your_part, info, goal)

my_tween:Play()

my_tween.Completed:Connect(function()
	print("Tween Completed!")
end)

I am not quite sure about why its glitching. but in your repeat loop you set the Camera CFrame (The Coordinate frame) to your Dummy. What this might mean is your changing the camera position every 0.1 seconds to a new position until script.Value = true? I am not sure why since script doesnt have a property of Value?

2 comments

0

I would set a video of what needs to happen but IDK how to upload one, but it's supposed to show 3 camera shots of a car passing by, then it goes to the dummy playing an animation. When the animation is completed he plays the last animation. That was the idea, but the camera can't keep up with the dummy's head-on command, if I do render step service it, won't do it on command.

0

also when the dummy gets hit by the car thats tween 2 then it will turn the value to true then tps the players camera to the next dummy.

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