#how can i put an animation with a script --> like the image

1 messages · Page 1 of 1 (latest)

sour gyro
#

model "Bed" is not a tool

#

so a localscript wont run under it

#

you can create a script and change its runcontext property to client

#

that'll make the (now local) script run for every player no matter where it exists

sour gyro
#

and tool.Parent = workspace (or something else)

unkempt wadi
sour gyro
#

oh

#

you didnt show explorer fully

#

that confused me

unkempt wadi
#

yea mb

sour gyro
#

can you send it

unkempt wadi
#

ofc

#

this is the whole bed

#

how can i like do the thing i want to do

#

because yea the problem is just the animation

sour gyro
#

wheres the tool

#

i dont see it

#

nor handle

unkempt wadi
#

let me explain

#

so i have a script that just turn the model into a tool

#

wait look

#

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local network = ReplicatedStorage:WaitForChild("Network", 3)
local notifyEvent = network:WaitForChild("Notify", 3)

local Objects = workspace:FindFirstChild("Objects"):GetChildren()

local function ObjectSelected(player: Player, object: Model)
assert(object and player, "Object or player hasn't got received correctly")

local character = player.Character

local objectHandle = object:FindFirstChild("Zone", true)
if not objectHandle then warn("you got no zone part in", object) end
objectHandle.Name = "Handle"

local newTool = Instance.new("Tool")
newTool:SetAttribute("Prix", object:GetAttribute("Prix"))
newTool.Name = object.Name
newTool.CanBeDropped = false

local aerm = character:FindFirstChild("Right Arm") :: BasePart

for i, instance in object:GetChildren() do
    if instance.ClassName == "LocalScript" then
        instance.Enabled = true
    else
        instance.Anchored = false
    end
    instance.Parent = newTool
end

newTool.Parent = character
newTool.Grip = CFrame.new(1.5,0,0) * CFrame.fromOrientation(math.rad(90),0,0)
notifyEvent:FireClient(player, "success", "You can now use this object", 3)

end

local function SetupObjectPress(object: Model)
assert(object, "erm...")

local zone = object:WaitForChild("Zone",5)
if not zone then warn("Couldn't find a suited zone for object", object.Name); return end

local clickDetector = object:FindFirstChildOfClass("ClickDetector")
if not clickDetector then
    clickDetector = Instance.new("ClickDetector")
    clickDetector.MaxActivationDistance = object:GetAttribute("MaxRange") or 15 
    clickDetector.Parent = zone
end

clickDetector.MouseClick:Connect(function(player)
    ObjectSelected(player, object)
end)

end

for i,object in ipairs(Objects) do
task.spawn(SetupObjectPress, object)
end

sour gyro
#

btw add three ` + lua after first trio for syntax higlighthing

unkempt wadi
#

okok thx :d

sour gyro
unkempt wadi
#

ahhh

#

i see

#

thx thx

sour gyro
#

try to replace the way you get character in the tool's localscript

local tool = script:FindFirstAncestorOfClass("Tool")
local lp = game.Players.LocalPlayer
local char = lp.Character or lp.CharacterAdded:Wait()
#

maybe the parents are incorrect

unkempt wadi
sour gyro
#

are there any errors in the output?

unkempt wadi
sour gyro
#

did you not see the error?

#

next time give out the error that would help a lot

#

anyways

#

i believe you're not copying the animation

#

you dont have to put into the tool not gonna lie

#

something like replicated storage would do

unkempt wadi
#

okayy

#

so now i put the local script in replicated storage ?

sour gyro
#

no

#

wait

unkempt wadi
#

okayy 🥲 its been 3 week im stuck on this and yea

sour gyro
#

oh bruh

unkempt wadi
#

yes..

sour gyro
#

change Animation in your code to Idle

#

the names dont match

#

probably

unkempt wadi
#

okay

sour gyro
#

yeah they didnt match

#

local anim = script.Animation

#

it had to be local anim = script.Idle

unkempt wadi
#

okay i think i know why

sour gyro
#

you renamed it?

sour gyro
#

the animation is called Idle but you wrote Animation

#

when saving it to a variable

unkempt wadi
#

ye i changed its not working

sour gyro
#

any errors?

#

also send the localscript's code

unkempt wadi
unkempt wadi
#

@sour gyro

#

trench rat

#

thx

#

you

#

men

#

you're a life safer

full moon
#

quick tip

unkempt wadi
#

its fix

#

😭

full moon
#

dont use toolbox in your games

unkempt wadi
full moon
#

its trash and ruins it

unkempt wadi
#

i use everything i made

#

my goal is 0 tool box

full moon
#

oh my bad, i was confused by ro defender stuff

unkempt wadi
#

yea

#

xd

full moon
#

alright alright my bad

unkempt wadi
#

it was just checking my first game

unkempt wadi
#

wait

full moon
unkempt wadi
#

look at my shop

#

what do you think

full moon
#

oh its pretty solid tbh

#

could be better with like more decorations

unkempt wadi
#

yea i will do it :D

full moon
#

because the shelf is a bit like "not decorateed"

#

yea its good its good

unkempt wadi
#

yea

#

thxx :D

burnt eagleBOT
#

studio** You are now Level 6! **studio

unkempt wadi
#

NOW i just need to fix this

#

but all work finally 😭

sour gyro
#

or even :Destroy() afterwards

#

animationTrack btw

#

not the animation thats called idle

#

oh

#

you already do that

unkempt wadi
sour gyro
#

does it error on :Stop()?

unkempt wadi
#

there is still the same error but its work

#

do you want the whole script ?

unkempt wadi
sour gyro
burnt eagleBOT
#

studio** You are now Level 16! **studio

sour gyro
#

remove the animation priority line

#

if you need it set to action reupload (and possibly overwrite existing one) it with that priority already set

unkempt wadi
unkempt wadi
sour gyro
#

localscript