Spike Trap not Tweening on Client

Hello,

I am making an obby but the spikes are on the client (for better performance). I want the hitbox of the spike trap (which is found on the server) to sync with the client, which is checked using the event. However some of the traps are not moving and I do not know why, all help is appreciated and if you would like any more information I will provide it.

-- Services
local TweenService = game:GetService("TweenService")
local CollectionService = game:GetService("CollectionService")

-- Variables
local EffectsModule = {}
local spike = script:WaitForChild("Spike")

-- Tweens
local spikeTweenIn = TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.In)
local spikeTweenOut = TweenInfo.new(0.15, Enum.EasingStyle.Quad, Enum.EasingDirection.In)

local function Tween()
	for _, spikeTrap in CollectionService:GetTagged("SpikeTrap") do
		local spike = spikeTrap.Hitbox:FindFirstChild("Spike")
		-- Ensure the spike exists before applying tweens
		if spike then
			TweenService:Create(spike, spikeTweenOut, {Position = spike.Position + Vector3.new(0, 3, 0)}):Play()
			print(1)
			task.wait(2.13)
			TweenService:Create(spike, spikeTweenIn, {Position = spike.Position + Vector3.new(0, -3, 0)}):Play()
			print(2)
			task.wait(2.7)
		end
	end
end

for _, spikeTrap in CollectionService:GetTagged("SpikeTrap") do
	local hitbox = spikeTrap:WaitForChild("Hitbox")
	if hitbox.Size.X == 4 and hitbox.Size.Z == 4 then
		local newSpike = spike:Clone()
		newSpike.Position = spikeTrap:WaitForChild("SpikeTrapBase").Position + Vector3.new(0, -1, 0)
		newSpike.Parent = spikeTrap.Hitbox
	
		--task.spawn(Tween, newSpike)
	end
end

game:GetService("ReplicatedStorage"):WaitForChild("SpikeSync").OnClientEvent:Connect(Tween)

return EffectsModule

Thank you for your help.

Uh i dont really get what you mean? How are the spikes on the client but the hitbox on server? the hitbox should also be on the client, can you explain a bit more?

This is on Client? If so, try turning off in Workspace.StreamingEnabled

1 Like

So the hitbox of the spike is on the server which kills the player however I want a visual spike.

This did not work but thank you for your efforts!

May i ask if its giving any errors?

No, there are no errors.

Extra text to let me send