Was wondering if I need to change anything or is it perfect? its for a rpg game
Here is the script:
function getPlayer(humanoid) local players = game.Players:children() for i = 1, #players do if players[i].Character.Humanoid == humanoid then return players[i] end end end
lvl = script.Parent.Parent.DoorSettings.Lvl.Value time = script.Parent.Parent.DoorSettings.OpenTime.Value
Door = script.Parent function onTouched(hit) print("Door Hit") local human = hit.Parent:findFirstChild("Humanoid") if (human ~= nil ) then
print("Human touched door")
local player = getPlayer(human)
if (player == nil) then return end local stats = player:findFirstChild("leaderstats") local sp = stats:findFirstChild("Lvl") if sp == nil then return false end if (sp.Value >= lvl) then print("Human passed test") Door.Transparency = 1 Door.CanCollide = false wait(time) Door.CanCollide = true Door.Transparency = 0.5 else human.Health = human.Health end end
end
connection = Door.Touched:connect(onTouched)

5 comments
That's not an answer xD
its a door level requirement script to go threw the door
that is confusing
So is there supposed to be an opening animation?
You can just use a simple weld.