Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I fix the script to make it so that the tool's size depends on how many points you have?

Here is my code:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEvents = ReplicatedStorage.RemoteEvents
local BurgerClicked = RemoteEvents.BurgerClicked
local CoinAdded = RemoteEvents.CoinAdded
local tool = script.Parent
local leaderstats = game.Workspace:FindFirstChild("leaderstats") -- Finds leaderstats
local Debounce = false

 
tool.Activated:Connect(function()
    if Debounce == false then
        Debounce = true
        BurgerClicked:FireServer()
		CoinAdded:FireServer()
        wait(.25)
        Debounce = false
    end
end)

tool.Handle.Size = leaderstats.Points.Value -- Tool grows as player points increases?

1 answer

You'll need to use events, in particular you'll want to use the Changed event on the leaderstats.Points

Every time the Changed event fires you should change the size of the Handle, however you wish to do that.

It should look something like:

leaderstats.Points.Changed:Connect(function()
  tool.Handle.Size = Vector3.new(1, leaderstats.Points.Value/5+.1, 1)
end)

1 comment

2

you will also want to adjust the grip on the tool so that you are holding it properly

This discussion is preserved as it was. New answers, comments, and votes are closed.