|
| 02 Feb 2014 04:03 PM |
So am am trying to make a king of the hill game. I am aiming for you to only have a sword when your physically touching the hill its self.
So I was trying to make a script that gave you a "sword" when you touch it, only if you you don't have a "sword " already.
I also was trying to make a script that removed all the "sword" you have in your inventory when you touch it.
I was only able to make scripts that give you a tool endlessly and that removes all tools you have. I also couldn't find an example of what I wanted, making it hard to script it.
If someone could please write me scripts for the two things I mentioned above, I would be very grateful. Thank you for helping me out! |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
| |
|
|
| 02 Feb 2014 07:46 PM |
Hill.TouchEnced:connect(function(hats)
end) |
|
|
| Report Abuse |
|
|
|
| 02 Feb 2014 07:48 PM |
Using TouchEnded is not the best way to do this...
|
|
|
| Report Abuse |
|
|
|
| 02 Feb 2014 07:52 PM |
| Do you have a better idea? If so, I would like to hear it! |
|
|
| Report Abuse |
|
|
| |
|
Arcionus
|
  |
| Joined: 30 Jan 2014 |
| Total Posts: 208 |
|
|
| 02 Feb 2014 08:27 PM |
| I actually have this same problem, my item giver just endlessly gives tools. It gets really annoying. |
|
|
| Report Abuse |
|
|
|
| 02 Feb 2014 08:29 PM |
| you need to have it check your items first, I just don't know how to script that... |
|
|
| Report Abuse |
|
|
|
| 02 Feb 2014 08:33 PM |
make a local script
local Player = game.Players.LocalPlayer
function Give() if Player.Backpack:findFirstChild("SwordNameHere")== nil then --Sword Give Code Here end end
script.Parent.Touched(Give) |
|
|
| Report Abuse |
|
|
|
| 02 Feb 2014 08:54 PM |
| doesn't seem to work with my item giver script. |
|
|
| Report Abuse |
|
|
|
| 02 Feb 2014 08:56 PM |
script.Parent.Touched:connect(function(p) pl = game.Players:GetPlayerFromCharacter(p.Parent) if not pl.Backpack:findFirstChild("Sword") then print'has' else PUTLOCATIONOFSWORDHERE.sword:clone().Parent = pl.Backpack end end) |
|
|
| Report Abuse |
|
|
Grove537
|
  |
| Joined: 05 Feb 2010 |
| Total Posts: 3478 |
|
|
| 02 Feb 2014 08:59 PM |
Put this in ur little giver brick thing:
function touch(hit) if hit.Parent:FindFirstChild("Humanoid") ~= nil then plr = game.Players:FindFirstChild(hit.Parent.Name) if plr.Backpack:FindFirstChild("Sword Name Here") == nil then --go to your sword here and clone it to plr.Backpack else plr.Backpack["Sword Name Here"]:Destroy() end end end script.Parent.Touched:connect(touch)
|
|
|
| Report Abuse |
|
|
| |
|