Workspace location error - local script

Hey!
I need help with a error that popped up indicating the part in workspace doesn’t exist but it does. Local script is placed in StarterPlayer and part located in Workspace as “Beenstore”.

local script:

local springForce = Vector3.new(0, 100, 0)
local springDuration = 0.3
local launchPart = game.Workspace.Beenstore

-- Gravity Variables
local gravityMultiplier = 5
local gravityDecayTime = 1 

-- WalkSpeed
local airWalkSpeed = 24
local defaultWalkSpeed = 16

-- TweenService animations
local TweenService = game:GetService("TweenService")

-- Scales for Beenstore
local growScale = Vector3.new(1.2, 0.8, 1.2)
local shrinkScale = Vector3.new(0.8, 1.2, 0.8)
local originalScale = launchPart.Size

-- tweens
local function createTween(targetSize, duration)
	return TweenService:Create(
		launchPart,
		TweenInfo.new(duration, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut),
		{ Size = targetSize }
	)
end


local growTween = createTween(originalScale * growScale, 0.15)
local shrinkTween = createTween(originalScale * shrinkScale, 0.15)
local resetTween = createTween(originalScale, 0.15)


local function applyDynamicGravity(humanoidRootPart)
	local bodyVelocity = Instance.new("BodyVelocity")
	bodyVelocity.MaxForce = Vector3.new(0, 1e5, 0) -- vertical force
	bodyVelocity.Velocity = Vector3.new(0, -gravityMultiplier * 50, 0) -- downward force
	bodyVelocity.Parent = humanoidRootPart


	for i = 1, 20 do
		bodyVelocity.Velocity = bodyVelocity.Velocity * 0.9
		task.wait(gravityDecayTime / 20)
	end

	bodyVelocity:Destroy()
end

-- Use Counter Variable
local useCounter = 0 -- number of uses
local debounce = false -- Debounce variable to prevent multiple triggers
local touchStartTime = nil -- Timer start time for touch timeout

-- Function to launch the player with effects
local function launchPlayer(hit)
	local character = hit.Parent
	if character and character:FindFirstChild("Humanoid") and not debounce then
		local humanoid = character:FindFirstChild("Humanoid")
		local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
		if humanoid and humanoidRootPart then
			debounce = true
			touchStartTime = tick() -- timer

			-- Counter
			useCounter = useCounter + 1
			print("Use Counter:", useCounter)

			-- Play spring animation
			growTween:Play()
			growTween.Completed:Wait()
			shrinkTween:Play()
			shrinkTween.Completed:Wait()
			resetTween:Play()

			
			local launchSound = Instance.new("Sound")
			launchSound.SoundId = "rbxassetid://123456789" -- sound
			launchSound.Volume = 1
			launchSound.Parent = launchPart
			launchSound:Play()
			game:GetService("Debris"):AddItem(launchSound, 2)

			
			local particleEmitter = Instance.new("ParticleEmitter")
			particleEmitter.Texture = "rbxassetid://1234567890" -- particle
			particleEmitter.Lifetime = NumberRange.new(0.5)
			particleEmitter.Rate = 50
			particleEmitter.Speed = NumberRange.new(10, 15)
			particleEmitter.Parent = launchPart
			particleEmitter:Emit(20)
			game:GetService("Debris"):AddItem(particleEmitter, 1)

			-- Launch the player
			local bodyVelocity = Instance.new("BodyVelocity")
			bodyVelocity.MaxForce = Vector3.new(1e5, 1e5, 1e5)
			bodyVelocity.Velocity = springForce
			bodyVelocity.Parent = humanoidRootPart

			-- air speed
			humanoid.WalkSpeed = airWalkSpeed
			task.delay(springDuration + gravityDecayTime, function()
				humanoid.WalkSpeed = defaultWalkSpeed
			end)

			
			task.spawn(applyDynamicGravity, humanoidRootPart)

			
			task.wait(springDuration)
			bodyVelocity:Destroy()

			-- Teleport the player after 10 uses
			if useCounter >= 10 then
				humanoidRootPart.CFrame = CFrame.new(-90, 33.5, -4)
				print("Teleported after 10 uses")
			end

			-- Reset after delay
			task.delay(0.5, function() debounce = false end)

			
			if useCounter >= 10 then
				useCounter = 1 -- Reset to 1 if counter exceeds 10
			end
		end
	end
end

-- Timeoutto reset counter if no touch within 10 seconds
local function resetCounterAfterTimeout()
	if touchStartTime and (tick() - touchStartTime > 10) then
		useCounter = 1
		touchStartTime = nil
		print("Counter reset due to timeout")
	end
end


game:GetService("RunService").Heartbeat:Connect(function()
	resetCounterAfterTimeout()
end)


launchPart.Touched:Connect(launchPlayer)

Location of Part ‘Beenstore’
image

Error:

I assume that you have StreamingEnabled turned on? I suspect that the part simply hasn’t loaded in yet.

If you replace

local launchPart = game.Workspace.Beenstore

with

local launchPart = game.Workspace:WaitForChild("Beenstore")

does it fix the issue?

(This basically just makes it wait for the part to load)

Is the part getting destroyed during playtest?

And some advice

-- do this
workspace
-- not this
game.Workspace

what @SeargentAUS said

Silly mistake. Thank you, Seargent