generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Make the GUI give you a sword when clicked

Previous Thread :: Next Thread 
FallenTacoz is not online. FallenTacoz
Joined: 05 Aug 2013
Total Posts: 328
02 Feb 2014 03:35 PM
Okay. This is the script in the GUI.
button = script.Parent

function clicked()
torso = button.Parent.Parent.Parent.Character.Torso
destination = script.Parent.Configuration.TeleportDestination.Value
torso.CFrame = CFrame.new(destination,torso.CFrame.lookVector)
local swordModel = game:GetService("InsertService"):LoadAsset(125013769)
swordModel:Clone().Parent = player.Backpack
end

script.Parent.MouseButton1Click:connect(function(a) clicked() end)
What am I doing wrong? It isn't giving you a sword.
Report Abuse
DragonOfWar900 is not online. DragonOfWar900
Joined: 11 May 2011
Total Posts: 1508
02 Feb 2014 04:09 PM
u failed on clone. you didnt told what player is

player = button.Parent.Parent.Parent
SW = swordModel:Clone()
SW.Parent = player.Backpack
Report Abuse
FallenTacoz is not online. FallenTacoz
Joined: 05 Aug 2013
Total Posts: 328
02 Feb 2014 05:27 PM
Didn't work.
Report Abuse
DragonOfWar900 is not online. DragonOfWar900
Joined: 11 May 2011
Total Posts: 1508
02 Feb 2014 05:46 PM
is becouse you got copied the part i puted to you tu replace the part of your script, the actual script is here:

button = script.Parent

function clicked()
torso = button.Parent.Parent.Parent.Character.Torso
destination = script.Parent.Configuration.TeleportDestination.Value
torso.CFrame = CFrame.new(destination,torso.CFrame.lookVector)
local swordModel = game:GetService("InsertService"):LoadAsset(125013769)
player = button.Parent.Parent.Parent
SW = swordModel:Clone()
SW.Parent = player.Backpack
end

script.Parent.MouseButton1Click:connect(function(a) clicked() end)
Report Abuse
FallenTacoz is not online. FallenTacoz
Joined: 05 Aug 2013
Total Posts: 328
02 Feb 2014 07:36 PM
Sword still doesn't appear in my backpack.
Report Abuse
FallenTacoz is not online. FallenTacoz
Joined: 05 Aug 2013
Total Posts: 328
02 Feb 2014 07:36 PM
And yes I added that little chunk of code into my script, so it was exactly how your script is above.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image