#scripting issue
134 messages · Page 1 of 1 (latest)
changes idle animation once i use a tool
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)```
oh thx
i wasn't asking u to write it for me but i do really appreciate that u did that :3
oh lol just wanted to help
lol
😠doesn't work
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
u ment lua print('Stopped '..Animation.Name)
for the Tool unequipped lol
but its ok
i didn't mean smth
its ur script not mine
i just wanted to wright anything even if it makes no sense
just to make sure the print is working
so did u do a play animation for the if tool is activated
the animation is idle
but are u playing it when tool is activated
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
it's inside the tool
did this already .-.
ok
Hmmm, maybe try using a server script for that
Since it's local script, it may not be able to access anim instances
it doesn't print starting animation when i equip the tool
Might be because it's a local script
ok
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
how do i get local player in a server script .-.
Second is use a server script and change it's run context to local
run context?
Yes
what does that mean
There's a property in server scripts called run context
Run context means how it will run according to the settings
Oof i forgor to ssy client instead of local
ok
lol a person
doesn't work
Client is bassically local script but it runs no matter what, even if it's parented under workspace or replicated storage, it will run
false for the workspace
Bro i am talking about run context's client option 💀
better to use Module Scripts for Workspace than a Local
I agree but , module scripts are better inside rep
Local is better inside SCR
Did you enable a setting in the tool called "requires handle"?
no
so it is off?
If it's off then it's good
If it's true and you have no handle part then oof
wait a minute
?
i think i let it on
Show me the property page screenshot
Showing the "RequiresHandle" option
Do you have a part inside your tool named "Handle?"
no
BRUH
i closed req handle thingy
UNCHECK THAT REQUIRE HANDLE STUFF
THAT'S WHAT PREVENTS YOUR SCRIPT FROM RUNNING A FUNCTION SND CONNECT IT
Have you turned it off yet?
i did turn it off
Aight now try it
IT WORKED!!!!!!!!11
Did yiu kept the run context stuff or reverted it?
i kept it
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
Aight, you happi?
Mark the channel as solved
ok
yes def
Im happy to hear about it
Case closed, detective nick/dead user heading for next case.
Bye
Bye
👋
Hope you succeed in your adventure
u sure u didnt use ChatGPT for that script
Mf, i didn't use charGPT
💀💀💀
Why tf would i use ChatGPT, i hate that damn ass bot
If i could, i would curse this bot to death if i could
and waht is ChatGPT
seems sus on how u did the script
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
Bro, i got all my knowledge from various different tutorial and countless of freemodels in a span of 7 months(still learning)
Im on my phone, so suggesting and correcting people is what i can do for now to help.
That is the greatest troll of all time
Sneak it in a rpblox exploit script and watch the kids scream in lag
and i do see some deprecated things in ur script
Like?
Bro, i just suggested some stuff, i didn't even make the script myself cuz im currently on mobile.