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

rebirth button is converting all coins to rebirths and rebirth noise is heard by all?

Asked by 3 years ago
Edited 3 years ago

this is the regular script inside a textbutton in a frame in a screengui

no errors

local Part = script.Parent
    Part.MouseButton1Click:Connect(function()
        local player = script.Parent.Parent.Parent.Parent.Parent
        if player then
            local leaderstats = player:WaitForChild("leaderstats")
            local Currency = leaderstats.Rebirths
            local Selling = leaderstats.Coins
            if (Selling.Value >= 1500) then
            Currency.Value = Currency.Value + Selling.Value + 1
            Selling.Value = 0
            player.leaderstats.Changes.Value = 0
            game.Workspace.clink.Playing = true
            wait(2)
            game.Workspace.clink.Playing = false
            end
        end
    end)

Idk how to get the sound "clink" to just play for the local player, because it would not play when inside the scripts Parent.

0
haven't i told you before, that when the person rebirths, it should just delete all data? Xyternal 247 — 3y
0
fixed that by adding player.leaderstats.Changes.Value = 0 Jakob_Cashy 79 — 3y

1 answer

Log in to vote
0
Answered by
epoke466 100
3 years ago

1.) A regular script can not find the "LocalPlayer" (Line 3) You will have to make this script a local script instead or replace line 3 with:

local player = script.Parent.Parent.Parent.Parent.Parent

2.) in line 8, you do not use "If" correctly, you got the general idea though. You need to replace line 8 with:

if (Selling.Value >= 1500 then)
0
this kinda works, but it just converts coins to rebirths and adds 1, also the end parenthesis was at 1500 not then lol Jakob_Cashy 79 — 3y
Ad

Answer this question