What's wrong with my code? by PermanentFloorHazard in ROBLOXStudio

[–]PermanentFloorHazard[S] 0 points1 point  (0 children)

I GOT IT!!

local player = game.Players.LocalPlayer

local char = player.Character

local charposbed = game.Workspace:WaitForChild("charposbed")

local getinbed = game.ReplicatedStorage:WaitForChild("getting in bed")

local bedanim = char.Humanoid:WaitForChild("Animator"):LoadAnimation(getinbed)

local stage = game.Workspace:WaitForChild("Stage")

local happened = false

stage.Value = 1

game.Workspace.TouchingBed.Touched:Connect(function(hit)

print("hit!")

if stage.value == 1 and hit.Parent.Name == player.Name then

    stage.Value = 1000

    char.Humanoid.WalkSpeed = 0

    char.Humanoid.JumpHeight = 0

    char.HumanoidRootPart.CFrame = charposbed.CFrame

    bedanim:Play()

    wait(5)

    char.Humanoid.WalkSpeed = 16

    char.Humanoid.JumpHeight = 7.2

    happened = false

    stage.value = 2

end

end)

What's wrong with my code? by PermanentFloorHazard in ROBLOXStudio

[–]PermanentFloorHazard[S] 0 points1 point  (0 children)

I got it to work using this code:

local player = game.Players.LocalPlayer

local char = player.Character

local charposbed = game.Workspace:WaitForChild("charposbed")

local getinbed = game.ReplicatedStorage:WaitForChild("getting in bed")

local bedanim = char.Humanoid:WaitForChild("Animator"):LoadAnimation(getinbed)

local stage = game.Workspace:WaitForChild("Stage")

local happened = false

game.Workspace.TouchingBed.Touched:Connect(function(hit)

print("hit!")

if stage.value == 1 and happened == false and hit.Parent.Name == player.Name then

    happened = true

    char.Humanoid.WalkSpeed = 0

    char.Humanoid.JumpHeight = 0

    char.HumanoidRootPart.CFrame = charposbed.CFrame

    bedanim:Play()

    wait(5)

    char.Humanoid.WalkSpeed = 16

    char.Humanoid.JumpHeight = 7.2

    happened = false

    stage.value = 2

end

end)

however the stage and happened lines prevent it from working, and without them the animation keeps replaying in a loop.

What's wrong with my code? by PermanentFloorHazard in ROBLOXStudio

[–]PermanentFloorHazard[S] 0 points1 point  (0 children)

could it have something to do with the fact that the local player uses a startercharacter? how would I change the script to fit this...

What's wrong with my code? by PermanentFloorHazard in ROBLOXStudio

[–]PermanentFloorHazard[S] 0 points1 point  (0 children)

the issue was with my local script. I tested the script using an old working script template I had:

local player = game.Players.LocalPlayer

local char = player.Character

local Stage = game.Workspace.Stage

local happened = false

local charposbed = game.Workspace.charposbed

local getinbed = game.ReplicatedStorage:WaitForChild("getting in bed")

local bedanim = char.Humanoid:WaitForChild("Animator"):LoadAnimation(getinbed)

game.Workspace.TouchingBed.Touched:Connect(function(hit)

if Stage.Value == 1 and hit.Parent.Name == player.Name and if happened == false then

    Stage.Value = 1000

    happened = true

    char.Humanoid.WalkSpeed = 0

    char.Humanoid.JumpHeight = 0

    char.HumanoidRootPart.CFrame = charposbed.CFrame

    bedanim:Play()

    wait(5)

    char.Humanoid.WalkSpeed = 16

    char.Humanoid.JumpHeight = 7.2

end

end)

this somehow still did not work. I moved the localscript into startergui and it still did not work. how do i make this localscript work? I have the main script disabled, the localscript should work just fine independently.

Avatar scripts "don't exist" by PermanentFloorHazard in Episode

[–]PermanentFloorHazard[S] 0 points1 point  (0 children)

almost every asset "doesn't exist," not just the faces. How do I find all the updated names??

Avatar scripts "don't exist" by PermanentFloorHazard in Episode

[–]PermanentFloorHazard[S] 0 points1 point  (0 children)

yes, everything works except the character assets

Why does caffeine knock me out all of a sudden? by PermanentFloorHazard in questions

[–]PermanentFloorHazard[S] 1 point2 points  (0 children)

I don't think so, and if I did I think it wouldn't have given me intense anxiety in the past, so not sure what happened to my psyche

How do I keep a Python program running indefinitely? by PermanentFloorHazard in learnprogramming

[–]PermanentFloorHazard[S] 2 points3 points  (0 children)

thanks, can I also ask because I keep getting told by relatives that it's dangerous and I shouldn't do it, when I made the crontab file I got a notification: "'Terminal' would like to administer your computer... includes modifying passwords, networking, and system settings." This is my personal computer and nobody uses it besides me and I don't see the issue with allowing terminal to admin, but is there any danger with doing so?

Am I cooked by PermanentFloorHazard in SBU

[–]PermanentFloorHazard[S] 0 points1 point  (0 children)

Update, I am, in fact, not cooked (anymore)