Yes, another simple script that I have no idea what I’m doing wrong on.
Could someone help me debug? No errors, the script is for a block that unanchors when touched, and goes back to the original position after 5 seconds.
Code:
local db = false
script.Parent.Touched:connect(function(hit)
if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") and not db then
db = true
local hum = hit.Parent:FindFirstChild("Humanoid")
hum.Sit = true
local posx = -99.188
local posy = 206.42
local posz = 1425.02
script.Parent.Anchored = false
script.Parent.CanCollide = false
wait(4)
script.Parent.Anchored = true
script.Parent.Position = Vector3.new(posx,posy,posx)
script.Parent.CanCollide = true
wait(1)
db = false
end
end)
Well the first thing is to check if it’s even getting into the if statement, add a print inside there. If the print is not printing, one of the conditions is not truthful
And as @RiccoMiller said, what type of script is it?
I did a few calculations, and figured out that the block would fall 1569.6 studs in 4 seconds if it’s in freefall and if the workspace gravity is 196.2 studs/seconds^2. Once the blocks fall in the void, they get destroyed. You can configure the FallenPartsDestroyHeight property of the workspace if you want to.