Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 6 years ago

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

Log in to vote
0
Answered by
clc02 553 Moderation Voter
6 years ago

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)
2
you will also want to adjust the grip on the tool so that you are holding it properly RetroGalacticGamer 331 — 6y
Ad

Answer this question