I am currently creating a player-controlled SCP 173. The way this script is supposed to work is if you are SCP 173, you can not move if a player who is not on the SCPs team is looking at you. However, after 5 seconds of being looked at, you can move freely for a couple seconds. There is a morph allowing you to transform as the entity.
Could it be possible the script is only loading on the morph and not the player?
However, when my character changes to SCP 173 the scripts are all there
This is the morph explorer
Script
local monster = script.Parent
local walkspeedDefault = 60
local walkspeedWhenLooked = 0
local cooldownDuration = 5 -- in seconds
local scpTeamName = "SCPs"
local function isPlayerLooking()
for _, player in ipairs(game.Players:GetPlayers()) do
local character = player.Character
if character and character:IsDescendantOf(game.Workspace) then
local humanoid = character:FindFirstChildOfClass("Humanoid")
if humanoid and humanoid.RigType == Enum.HumanoidRigType.R6 then
local direction = (monster.Torso.Position - character.Head.Position).unit
local ray = Ray.new(character.Head.Position, direction * 1000)
local part, hitPosition = game.Workspace:FindPartOnRay(ray, monster)
if part and part:IsDescendantOf(monster) then
return player
end
wait(0.1)
end
end
end
return nil
end
local function isPlayerInSCPteam(player)
local team = player.Team
if team then
return team.Name == scpTeamName
end
return false
end
local function setWalkspeed(walkspeed)
monster.Humanoid.WalkSpeed = walkspeed
end
local function onLookedAt()
setWalkspeed(walkspeedWhenLooked)
wait(cooldownDuration)
setWalkspeed(walkspeedDefault)
end
while true do
local lookingPlayer = isPlayerLooking()
if lookingPlayer then
if not isPlayerInSCPteam(lookingPlayer) then
onLookedAt()
end
end
wait(0.1) -- Check for player looking every 0.1 second
end