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

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

Asked by 5 years ago
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

Log in to vote
0
Answered by
IcyMizu 122
5 years ago
Edited 5 years ago

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

0
The problem is that its a server broadcast so it would work for everyone... CNK12321 0 — 5y
0
it wouldnt if its done trough remote events it would only trigger for the player who triggerd it IcyMizu 122 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

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!

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. fighterkirbyzx 102 — 5y
0
Erm i will try again but when you but a tool in the character it should but equip it automaticly CNK12321 0 — 5y
0
No it dose not work CNK12321 0 — 5y
0
And it would not work as a server script because of the local player stuff... CNK12321 0 — 5y
0
Well, thats all i could think of... Best of luck! fighterkirbyzx 102 — 5y

Answer this question