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

I am trying to give the player a tool but it is not working?

local ToolLocation = game.Workspace.StickStorage.BasicStick --Location of the tool
local Cost = (0) -- Replace 0 with the cost of the item
script.Parent.MouseClick:Connect(function() -- left mouse button down then
	if game.Players.LocalPlayer.leaderstats.Money > (Cost -1) then -- if player has enough money
		ToolLocation:Clone(game.Players.LocalPlayer.Character) -- Clone the tool and but it into the players inventory
		game.Players.LocalPlayer.leaderstats.Money = game.Players.LocalPlayer.leaderstats.Money (-Cost)-- Remove moeny
	end
end)

I am using a local script if that helps anything

2 answers

U should add things like money,give tools trough a server script i cant comment so i say this in a answer.U could do this with remote events

2 comments

0

The problem is that its a server broadcast so it would work for everyone...

0

it wouldnt if its done trough remote events it would only trigger for the player who triggerd it

Easy fix.

Your putting the tool in the character. The backpack, or

player.LocalPlayer.Backpack

Is the thing that the player can click on and have it appear. So you would write:

 ToolLocation:Clone(game.Players.LocalPlayer.BackPack)

Hope this works!

5 comments

0

Another problem is it might need to be in a server script. Im not sure how tools work entirely, but I do know that creating parts in the client will only let that specific client see it.

0

Erm i will try again but when you but a tool in the character it should but equip it automaticly

0

No it dose not work

0

And it would not work as a server script because of the local player stuff...

0

Well, thats all i could think of... Best of luck!

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