#scripting issue

134 messages · Page 1 of 1 (latest)

worthy tendon
#

lol what does that do

cursive geode
#

changes idle animation once i use a tool

worthy tendon
#

so here is the fix to that code```lua
local Players = game:GetService("Players")

local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Animate = Character:WaitForChild("Animate")
local idle1 = Animate.idle.Animation1

local Animation = "rbxassetid://12954665621"
local currentIdle = idle1.AnimationId

local function playAnimation()
idle1.AnimationId = Animation
end

local function stopAnimation()
idle1.AnimationId = currentIdle
end

tool.Equipped:Connect(playAnimation)
tool.Unequipped:Connect(stopAnimation)```

cursive geode
#

oh thx

#

i wasn't asking u to write it for me but i do really appreciate that u did that :3

worthy tendon
#

oh lol just wanted to help

cursive geode
#

i will add
local tool = script.parent

#

cuz u didn't add it .-.

worthy tendon
#

lol

cursive geode
#

😭 doesn't work

worthy tendon
#

oh

#

oh did u try tool.Activated

#

instead

cursive geode
#

ima try

#

ima try to put a print or whatever

#

i did print smth

#
local Players = game:GetService("Players")

local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Animate = Character:WaitForChild("Animate")
local idle1 = Animate.idle.Animation1

local Animation = "rbxassetid://12954665621"
local currentIdle = idle1.AnimationId
local tool = script.Parent
print("a7a")

local function playAnimation()
    idle1.AnimationId = Animation
    print("starting animation")
end

local function stopAnimation()
    idle1.AnimationId = currentIdle
    print("stopping animation")
end
tool.Equipped:Connect(playAnimation)
tool.Unequipped:Connect(stopAnimation)

print("done")
#

it prints a7a and done

#

but not the other things

#

so the problem is prob while we are calling the function

worthy tendon
#

u ment lua print('Stopped '..Animation.Name)

#

for the Tool unequipped lol

#

but its ok

cursive geode
#

i didn't mean smth

worthy tendon
#

its ur script not mine

cursive geode
#

i just wanted to wright anything even if it makes no sense

#

just to make sure the print is working

worthy tendon
#

so did u do a play animation for the if tool is activated

cursive geode
#

the animation is idle

worthy tendon
#

but are u playing it when tool is activated

cursive geode
#

when it's equipped

#

when you click the number that lets u hold the tool .-.

median salmon
#

DID YOU PARENT THE LOCAL SCRIPT INSIDE STARTER CHARACTER OR STARTER PLAYER SCRIPTS????

#

IF TOU DIDN'T THEN IM GONNA-

#

If it's parent is inside a tool then it will work also

#

Equip your tool and move around then stop

cursive geode
cursive geode
median salmon
#

Hmm, lemme read the script

#

I'll be back

cursive geode
#

ok

median salmon
#

Since it's local script, it may not be able to access anim instances

cursive geode
#

ok

#

btw the problem is that the script doesn't connect the functions

cursive geode
median salmon
cursive geode
#

ok

median salmon
#

Local scripts start to run if it's parent is related to player related stuff

#

So the event fires before the local script is done running

#

I have 2 ways for ya

#

First is use a server script

cursive geode
#

how do i get local player in a server script .-.

median salmon
#

Second is use a server script and change it's run context to local

cursive geode
#

run context?

median salmon
cursive geode
#

what does that mean

median salmon
#

There's a property in server scripts called run context

median salmon
cursive geode
#

there is client and legacy and server

#

no local

median salmon
#

Oof i forgor to ssy client instead of local

cursive geode
#

ok

worthy tendon
#

lol a person

cursive geode
#

doesn't work

median salmon
# cursive geode ok

Client is bassically local script but it runs no matter what, even if it's parented under workspace or replicated storage, it will run

median salmon
worthy tendon
#

better to use Module Scripts for Workspace than a Local

median salmon
#

Local is better inside SCR

cursive geode
#

im just forget that thing

#

it's def broken

#

it won't work normally

median salmon
cursive geode
#

no

median salmon
#

so it is off?

#

If it's off then it's good

#

If it's true and you have no handle part then oof

cursive geode
#

wait a minute

median salmon
cursive geode
#

i think i let it on

median salmon
#

Showing the "RequiresHandle" option

cursive geode
#

andddd

#

it was on

#

now im in another problem

median salmon
cursive geode
#

no

median salmon
#

BRUH

cursive geode
#

i closed req handle thingy

median salmon
#

UNCHECK THAT REQUIRE HANDLE STUFF

#

THAT'S WHAT PREVENTS YOUR SCRIPT FROM RUNNING A FUNCTION SND CONNECT IT

median salmon
cursive geode
#

i did turn it off

median salmon
#

Aight now try it

cursive geode
#

IT WORKED!!!!!!!!11

median salmon
#

FINALLY

#

FINALLY GOSH DARN

#

JUST BECAUSE OF A SMALL CHECK

median salmon
cursive geode
median salmon
#

If you kept it then oof, that's gonna cause a huge problem

#

It runs for every single client

#

You better revert it

#

you don't want the whole lobby playing the same anim just because someone equipped a tool

median salmon
median salmon
cursive geode
#

ok

cursive geode
median salmon
#

Case closed, detective nick/dead user heading for next case.

#

Bye

cursive geode
#

Bye

median salmon
#

👋

median salmon
worthy tendon
median salmon
#

💀💀💀

median salmon
#

If i could, i would curse this bot to death if i could

worthy tendon
#

and waht is ChatGPT

worthy tendon
median salmon
# worthy tendon and waht is ChatGPT

That is a bot that tries to be human as possible and make scripts for you that doesn't work 54% of the time when you try to run it on roblox studio

median salmon
median salmon
worthy tendon
#

now this is a real script

median salmon
#

Sneak it in a rpblox exploit script and watch the kids scream in lag

worthy tendon
#

and i do see some deprecated things in ur script

median salmon
#

Bro, i just suggested some stuff, i didn't even make the script myself cuz im currently on mobile.