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

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

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.

1 comment

0

you should probably define the first instance u make and then use particle emitter instance for the first instances variable

1 answer

✓ Accepted answer

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")".

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