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

Help with buying weapon only works in studio mode?

The buy script below only works in studio mode ;( I get no errors.

Price = 5
Player = game.Players.LocalPlayer
local SpeedCoil = game.ServerStorage.Weapons.SpeedCoil
local Taken = SpeedCoil.Taken

script.Parent.MouseButton1Click:connect(function()
	if Player:FindFirstChild("leaderstats") and Player.leaderstats["Gold bars"].Value >= Price then
		if Taken.Value == false then
			Player.leaderstats["Gold bars"].Value = Player.leaderstats["Gold bars"].Value - Price
			SpeedCoil:Clone().Parent = Player.Backpack
			SpeedCoil:Clone().Parent = Player.StarterGear
			Taken.Value = true
		end
	end
end)

1 answer

✓ Accepted answer

You can't access ServerStorage through Local scripts. Change it to replicatedstorage and it'll work.

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