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

HELP NEEDED ON STORE GUI THAT SELLS TRAILS FOR MY GAME. ANYONE HELP?

Asked by 6 years ago

Hello! I need help with my GUI. I am making a store that sells trails. It uses a currency called "Cash." Can someone help me and tell what I did wrong?

quick1 = game.Players.LocalPlayer.Stats.Cash
quick2 = game.Players.LocalPlayer.HumanoidRootPart
num1 = 1000

script.Parent.MouseButton1Click:connect(function()
    if game.Players.LocalPlayer.Stats.Cash.Value >= 1000 then 
        quick1.Value = quick1.Value - num1
        Instance.new("Part", game.Players.LocalPlayer.HumanoidRootPart)
        Instance.new("ParticleEmitter", quick2.Part)
        quick2.Part.Transparency = 1
        quick2.Part.ParticleEmitter.EmissionDirection = 'Back'
        quick2.Part.ParticleEmitter.Color = "Bright blue"
    end
end)

Thank you in advance.

0
you should probably define the first instance u make and then use particle emitter instance for the first instances variable greatneil80 2647 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

Your mistake resides on the second line of your script, where you define your "quick2" value.

quick2 = game.Players.LocalPlayer.HumanoidRootPart

This won't work since the HumanoidRootPart is not located in the LocalPlayer, but rather in the LocalPlayer's Character. So the correct way to define this variable would be:

quick2 = game.Players.LocalPlayer.Character:WaitForChild("HumanoidRootPart")

Notice the ".Character" and the ":WaitForChild("HuamanoidRootPart")".

Ad

Answer this question