#Help in my script

1 messages · Page 1 of 1 (latest)

visual orbit
#

can you add. when the player left peek. the camera goes left a little.

#

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")

local UserInputService = game:GetService("UserInputService")
local TweenService = game:GetService("TweenService")

local AnimationID = "108605383399578"
local CameraOffsetOn = Vector3.new(0, 0, 0)
local CameraOffsetOff = Vector3.new(0, 0, 0)

local WalkSpeedRightPeeked = 0 --ADJUST RightPeek SPEED HERE
local WalkSpeedStanding = 10 -- IF you using a SHIFT SPRINT or any other script, make sure walk speeds match up!!
local PlaybackSpeedRightPeeked = 0.70
local PlaybackSpeedStanding = 1

local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://" .. AnimationID
local RightPeekAnimation = Humanoid:LoadAnimation(Animation)

local function setRightPeekState(isRightPeeking)
if isRightPeeking then
Humanoid.WalkSpeed = WalkSpeedRightPeeked
TweenService:Create(Humanoid, TweenInfo.new(0.25), { CameraOffset = CameraOffsetOn }):Play()
Character.HumanoidRootPart.Running.PlaybackSpeed = PlaybackSpeedRightPeeked
Character.HumanoidRootPart.CanCollide = false
RightPeekAnimation:Play()

    while wait() do
        if Humanoid.MoveDirection.Magnitude > 0 then
            RightPeekAnimation:AdjustSpeed(1)
        else
            RightPeekAnimation:AdjustSpeed(0)
        end
    end
else
    Humanoid.WalkSpeed = WalkSpeedStanding
    TweenService:Create(Humanoid, TweenInfo.new(0.25), { CameraOffset = CameraOffsetOff }):Play()
    Character.HumanoidRootPart.Running.PlaybackSpeed = PlaybackSpeedStanding
    Character.HumanoidRootPart.CanCollide = true
    RightPeekAnimation:Stop()
end

end

UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
if not gameProcessedEvent then
if input.KeyCode == Enum.KeyCode.T then --buttons to RightPeek HERE ( make sure to change it on line 55 too)
setRightPeekState(true)
end
end
end)

UserInputService.InputEnded:Connect(function(input, gameProcessedEvent)
if not gameProcessedEvent then
if input.KeyCode == Enum.KeyCode.T then -- buttons (make sure they match to the line above^^)
setRightPeekState(false)
end
end
end)

#

here

#

can you teach me how to make this?
when the player left peek. the camera goes left a little.

#

and i have a question. when the player peek. the peek animations works to the server or only the player? i put this code in a localscript inside starter-character-scripts

paper mauve
#

no

#

the channel is only for bugs

#

we dont script for you

visual orbit
#

i dont want you to script.

#

i want to learn how do i do it

paper mauve
elfin gull
visual orbit
#

so whos gonna help me..

whole cosmos
#

Lemme see

#

I got this

visual orbit
#

alr

whole cosmos
#

@crude cave

#

Lemme handle ts first

#

..

#

Wait a min…

#

@crude cave

#

u got td

#

Ts

#

XD

visual orbit
#

lol

crude cave
whole cosmos
#

Bro

#

Even humanoid has a position?

crude cave
#

Vector3.new(-1, 0, 0) for left, Vector3.new(1, 0, 0) for right

#

and then just set it to 0 when you dont want it to peek

visual orbit
#

alr wait i will try

whole cosmos
#

Humanoid have position

crude cave
#

its called a cameraoffset

whole cosmos
#

I thought humanoid just makes the model

#

Work

whole cosmos
crude cave
#

yeah

#

core scripts use it

whole cosmos
#

Oh

crude cave
#

so it can position the camera

paper mauve
#

Vector3.fromRGB(255,0,0)

whole cosmos
paper mauve
#

no

#

fromRGB

visual orbit
#

doesnt work. i put it here

UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
if not gameProcessedEvent then
if input.KeyCode == Enum.KeyCode.T then --buttons to RightPeek HERE ( make sure to change it on line 55 too)
setRightPeekState(true)
Vector3.new(1, 0, 0)
end
end
end)

UserInputService.InputEnded:Connect(function(input, gameProcessedEvent)
if not gameProcessedEvent then
if input.KeyCode == Enum.KeyCode.T then -- buttons (make sure they match to the line above^^)
setRightPeekState(false)
Vector3.new(0, 0, 0)
end
end
end)

whole cosmos
#

Isn’t that color

paper mauve
#

no

#

ur wrong

#

im right

whole cosmos
paper mauve
#

im obv joking fatass

whole cosmos
#

Oh

paper mauve
#

its okay I forgive your ignorance <3

visual orbit
#

wdym

paper mauve
#

both are using keycode T

visual orbit
#

yh its when he click on T the pose = true. and when he release. = false

#

@paper mauve

paper mauve
#

oh wait one is inputended

#

mb

visual orbit
#

its alr

#

so now. how can i let the camera go in the same direction of the peek

paper mauve
#

.

stuck zodiac
#

u just put vector3 bro

paper mauve
#

yea

visual orbit
#

i did. it doesnt work

paper mauve
#

u didnt even change the camera offset

stuck zodiac
#

u didnt even manipulate the cameraoffset

paper mauve
#

U have to

#

change

#

it

#

not just put vector.3new

#

vector3.new

stuck zodiac
#

but it wont be smooth

visual orbit
#

see. i didnt learn cameraoffset yet. so i am dumb in these things

stuck zodiac
#

to let yk

visual orbit
paper mauve
#

tween

stuck zodiac
#

ye

visual orbit
#

UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
if not gameProcessedEvent then
if input.KeyCode == Enum.KeyCode.T then --buttons to RightPeek HERE ( make sure to change it on line 55 too)
setRightPeekState(true)
Vector3.new(1, 0, 0)
end
end
end)

UserInputService.InputEnded:Connect(function(input, gameProcessedEvent)
if not gameProcessedEvent then
if input.KeyCode == Enum.KeyCode.T then -- buttons (make sure they match to the line above^^)
setRightPeekState(false)
Vector3.new(0, 0, 0)
end
end
end)

#

i marked it for yall

stuck zodiac
#

as example

stuck zodiac
#

u forgot to put Humanoid.CameraOffset

visual orbit
#

oh wait

stuck zodiac
visual orbit
#

wait aint it like that

#

Humanoid.CameraOffset = Vector3.new(1, 0, 0)

#

this also doesnt work

stuck zodiac
#

yes

#

should

visual orbit
#

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")

local UserInputService = game:GetService("UserInputService")
local TweenService = game:GetService("TweenService")

local AnimationID = "108605383399578"
local CameraOffsetOn = Vector3.new(0, 0, 0)
local CameraOffsetOff = Vector3.new(0, 0, 0)

local WalkSpeedRightPeeked = 0 --ADJUST RightPeek SPEED HERE
local WalkSpeedStanding = 10 -- IF you using a SHIFT SPRINT or any other script, make sure walk speeds match up!!
local PlaybackSpeedRightPeeked = 0.70
local PlaybackSpeedStanding = 1

local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://" .. AnimationID
local RightPeekAnimation = Humanoid:LoadAnimation(Animation)

local function setRightPeekState(isRightPeeking)
if isRightPeeking then
Humanoid.WalkSpeed = WalkSpeedRightPeeked
TweenService:Create(Humanoid, TweenInfo.new(0.25), { CameraOffset = CameraOffsetOn }):Play()
Character.HumanoidRootPart.Running.PlaybackSpeed = PlaybackSpeedRightPeeked
Character.HumanoidRootPart.CanCollide = false
RightPeekAnimation:Play()

    while wait() do
        if Humanoid.MoveDirection.Magnitude > 0 then
            RightPeekAnimation:AdjustSpeed(1)
        else
            RightPeekAnimation:AdjustSpeed(0)
        end
    end
else
    Humanoid.WalkSpeed = WalkSpeedStanding
    TweenService:Create(Humanoid, TweenInfo.new(0.25), { CameraOffset = CameraOffsetOff }):Play()
    Character.HumanoidRootPart.Running.PlaybackSpeed = PlaybackSpeedStanding
    Character.HumanoidRootPart.CanCollide = true
    RightPeekAnimation:Stop()
end

end

UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
if not gameProcessedEvent then
if input.KeyCode == Enum.KeyCode.T then --buttons to RightPeek HERE ( make sure to change it on line 55 too)
setRightPeekState(true)
Humanoid.CameraOffset = Vector3.new(1, 0, 0)
end
end
end)

UserInputService.InputEnded:Connect(function(input, gameProcessedEvent)
if not gameProcessedEvent then
if input.KeyCode == Enum.KeyCode.T then -- buttons (make sure they match to the line above^^)
setRightPeekState(false)
Humanoid.CameraOffset = Vector3.new(0, 0, 0)
end
end
end)

#

here is my code. idk whats wrong

#

@stuck zodiac

stuck zodiac
#

yes

#

wait

#

ah it works

#

who u got the script from?

visual orbit
stuck zodiac
#

ah

visual orbit
#

i duplicated it. one for left and one for right

stuck zodiac
#

ur script has no problem lol

#

u just forgot to input the vector3

#

here

#

wait

#

both Vectors were 0,0,0

#

thats why it didnt work

visual orbit
#

wait a sec

stuck zodiac
#

well it did work but there was no effect

#

it also tweens

#

so its smooth

visual orbit
stuck zodiac
#

look

#

ON is when u press T

#

so it goes right

#

OFF is when u release T

#

so it goes to normal

#

so ON is 1,0,0

visual orbit
#

alr wait i will test

stuck zodiac
#

and OFF 0,0,0

#

u will understand when u change it

visual orbit
#

@stuck zodiac

#

btw let this thread open. i gtg. when i am back we will continue. i am back at 5:20 pm. its 3:27 pm rn in my timexone

#

zone*

#

@stuck zodiac cya

visual orbit
#

Back

#

@stuck zodiac

#

@sinful leaf can you help me?

sinful leaf
visual orbit
#

lol

#

js i need help

#

@sinful leaf

#

.

#

ty

sinful leaf
# visual orbit <@266068916634255363>

i'll check on this tomorrow but for the moment, bruh, this code: ```lua

local function setRightPeekState(isRightPeeking)
if isRightPeeking then
Humanoid.WalkSpeed = WalkSpeedRightPeeked
TweenService:Create(Humanoid, TweenInfo.new(0.25), { CameraOffset = CameraOffsetOn }):Play()
Character.HumanoidRootPart.Running.PlaybackSpeed = PlaybackSpeedRightPeeked
Character.HumanoidRootPart.CanCollide = false
RightPeekAnimation:Play()

    while wait() do
        if Humanoid.MoveDirection.Magnitude > 0 then
            RightPeekAnimation:AdjustSpeed(1)
        else
            RightPeekAnimation:AdjustSpeed(0)
        end
    end```

what on earth is that while loop doing? it literally runs forever! even if it errors!

#

why agony

visual orbit
#

evilcat HUH

crude cave
#

and you run it like

#

amillion times

#

dw pyro ill take over

visual orbit
#

still doesnt work...

#

||@.pyrofire ||

#

@sinful leaf

#

@sinful leaf

sinful leaf
sinful leaf
visual orbit
#

cause you r a good developer

sinful leaf
crude cave
#

have you ever thought about understanding and making it yourself

sinful leaf
crude cave
sinful leaf
crude cave
#

🔥

#

s4 here i come

visual orbit
#

...

#

...,lkjuytrewqweedfghj,kmjnhgfd4scedrtfhujio[p;]';[plkjwaethujikopijuhygtf6r5detfhyui0o-p[

#

';juhygfdsasdfghjkl;'

#

kjhgfdsdfghjkl;'

crude cave
#

and it stacks

#

just rewrite your script

#

trust

stuck zodiac
#

HAVE YOU EVER PLAYED BLOX FRUITS WITH YOUR LIFE ON THE LINE?

visual orbit
stuck zodiac
#

show the script

visual orbit
#

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")

local UserInputService = game:GetService("UserInputService")
local TweenService = game:GetService("TweenService")

local AnimationID = "108605383399578"
local CameraOffsetOn = Vector3.new(0, 0, 0)
local CameraOffsetOff = Vector3.new(0, 0, 0)

local WalkSpeedRightPeeked = 0 --ADJUST RightPeek SPEED HERE
local WalkSpeedStanding = 10 -- IF you using a SHIFT SPRINT or any other script, make sure walk speeds match up!!
local PlaybackSpeedRightPeeked = 0.70
local PlaybackSpeedStanding = 1

local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://" .. AnimationID
local RightPeekAnimation = Humanoid:LoadAnimation(Animation)

local function setRightPeekState(isRightPeeking)
if isRightPeeking then
Humanoid.WalkSpeed = WalkSpeedRightPeeked
TweenService:Create(Humanoid, TweenInfo.new(0.25), { CameraOffset = CameraOffsetOn }):Play()
Character.HumanoidRootPart.Running.PlaybackSpeed = PlaybackSpeedRightPeeked
Character.HumanoidRootPart.CanCollide = false
RightPeekAnimation:Play()

    while wait() do
        if Humanoid.MoveDirection.Magnitude > 0 then
            RightPeekAnimation:AdjustSpeed(1)
        else
            RightPeekAnimation:AdjustSpeed(0)
        end
    end
else
    Humanoid.WalkSpeed = WalkSpeedStanding
    TweenService:Create(Humanoid, TweenInfo.new(0.25), { CameraOffset = CameraOffsetOff }):Play()
    Character.HumanoidRootPart.Running.PlaybackSpeed = PlaybackSpeedStanding
    Character.HumanoidRootPart.CanCollide = true
    RightPeekAnimation:Stop()
end

end

UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
if not gameProcessedEvent then
if input.KeyCode == Enum.KeyCode.T then -- buttons to RightPeek HERE ( make sure to change it on line 55 too)
setRightPeekState(true)
Humanoid.CameraOffsetOn = Vector3.new(1, 0, 0)
end
end
end)

UserInputService.InputEnded:Connect(function(input, gameProcessedEvent)
if not gameProcessedEvent then
if input.KeyCode == Enum.KeyCode.T then -- buttons (make sure they match to the line above^^)
setRightPeekState(false)
Humanoid.CameraOffsetOff = Vector3.new(0, 0, 0)
end
end
end)

#

@stuck zodiac

stuck zodiac
#

Remove the while wait() do

#

And the Humanoid.CameraOffset = vector3.new

#

Both of them