Ive been working on a pizza tower fangame in roblox studio and this script for going into the tutorial gate only changes the walkspeed half the time. Its really annoying and I need help for fixing it. Heres the script, located in the fade gui:
local fade = script.Parent
local TweenService = game:GetService("TweenService")
wait(8)
local tutorialgate = game.Workspace.TutorialGate.Portal
local humanoidRootPart = game.Players.LocalPlayer.Character:FindFirstChild("HumanoidRootPart")
local tutorialpos = Vector3.new(-11, 46.546, 62.799) -- Example coordinates
tutorialgate.Touched:Connect(function(hit)
game.Players.LocalPlayer.Character:FindFirstChildWhichIsA("Humanoid").WalkSpeed = 0
game.Players.LocalPlayer.Character:FindFirstChildWhichIsA("Humanoid").JumpPower = 0
TweenService:Create(
fade,
TweenInfo.new(0.5), -- Amount of seconds
{BackgroundTransparency = 0} -- Goal
):Play() -- Plays your tween
task.wait(0.5)
game.Players.LocalPlayer.Character:FindFirstChildWhichIsA("Humanoid").WalkSpeed = 20
game.Players.LocalPlayer.Character:FindFirstChildWhichIsA("Humanoid").JumpPower = 80
game.Workspace.HubMusic:Stop()
game.Workspace.TutorialMusic:Play()
humanoidRootPart.CFrame = CFrame.new(tutorialpos)
TweenService:Create(
fade,
TweenInfo.new(0.5), -- Amount of seconds
{BackgroundTransparency = 1} -- Goal
):Play() -- Plays your tween
end)
Thanks!