Need help with a couple scripts

Hello, Roblox Devs. My name is “Hunter”, im trying to make a game,but i can’t figure out these scripts.
could anyone help me out?
does anyone know how to script his pineapple to give me pineapple currency leaderstat
and also play an animation at the same time?

Have you tried researching your issue before coming to devforum?

yes,haven’t found anything.i have looked on youtube for tutorials too.

Ok, I will post a video that will help you because I am too lazy to type out a script.

1 Like

awesome,reply when its ready! thanks

Alright! I have found a channel that will help you out a lot with your game! Search up Steadyon roblox in youtube and then scroll in his videos. he has a weight lifting simulator scripting video series that will help you with your problem. Although you may not be making a simulator game, I totally recommend it!

1 Like

ok,ill check him out! i couldn’t find anyone,so,hopefully this helps

I think its better to learn a concept rather than copy a script, so I hope you learn something from his videos!

1 Like

me too,i dream of being a pro scripter

Lol me too! If you have a discord, you should send it to me, so we can talk more about scripting!

It seems like you’re pretty new to scripting so here are some good places to get you started:


To answer your question, I’m assuming by

how to script his pineapple to give me pineapple currency leaderstat
and also play an animation at the same time?

you mean to add a certain amount to the Pineapples leaderstat and play an animation when the tool is activated, so what you’ll mainly need is Tool.Activated which is an event that fires when you have a tool equipped and press LMB, and a remote to tell the server to increment the Pineapples leaderstat (remote events allow communication between clients and server)

--local script (inside tool)
local Tool = script.Parent
local Player = game.Players.LocalPlayer
local PineappleEvent = game.(Path to remote).(RemoteName)

Tool.Activated:Connect(function()
 --in order to play animations on characters you need to call :LoadAnimation(AnimInstance) on their humanoid and call :Play() on the animation track that is returned from it
 local AnimationInstance = Instance.new("Animation")
 AnimationInstance.AnimationId = "id here"
 local LoadedAnimation = Player.Character.Humanoid:LoadAnimation(AnimationInstance)
 LoadedAnimation:Play()
 AnimationInstance:Destroy()

 PineappleEvent:FireServer() --fire remote event
end)
--server script
local PineappleEvent = game.(Path to remote).(RemoteName)

PineappleEvent.OnServerEvent:Connect(function(Player) --.OnServerEvent is fired when :FireServer() is called from a client, it's first default argument is the player who fired the remote
 Player.leaderstats.Pineapples += 1 --incrementing the Pineapples leaderstat
end)
--this isn't very secure since exploiters can fire remotes whenever they want, so you will need to add sanity checks

This script isn’t perfect so you’ll have to adjust it and whatnot to your needs

i do,i dont use it that often,but i can add you

ok mine is its ruByyy! #5461! whats yours?

also i recommend looking at deternity’s post as it has a lot of useful information you can use later on in the future.

1 Like

hunterRBX#6397,ill send a fr…30 chars

nvm,send me one please…doesnt work

ok! will do! i need 30 chars so i am typing random stuff.

hmmm are you sure your username is hunterRBX#6397 bc when I type it in it says the request failed

yes, here try again, HunterRBX#6397

there we go! request sent! 30 char

1 Like