|
| 13 Jan 2015 02:55 PM |
Ok I have been trying for ages and I can't get this to work someone help me pls.
function onButtonClicked() player = script.Parent.Parent.Parent.Parent.Parent.Character
h = Instance.new("Hat") p = Instance.new("Part") h.Name = "ArmyHelmet" p.Parent = h p.Position = player.Head.Position p.Name = "Handle" p.formFactor = 0 p.Size = Vector3.new(0, 0, 0) p.BottomSurface = 0 p.TopSurface = 0 p.Locked = true game.ServerStorage.Mesh:Clone().Parent = p h.Parent = player h.AttachmentPos = Vector3.new(0, 0, 0)
end
script.Parent.MouseButton1Click:connect(onButtonClicked)
|
|
|
| Report Abuse |
|
|
|
| 13 Jan 2015 02:58 PM |
ServerStorage is for scripts only. And since your working with localscripts, it won't work.
Try working with Lighting or ReplicatedStorage. |
|
|
| Report Abuse |
|
|
025110
|
  |
| Joined: 23 Nov 2012 |
| Total Posts: 57661 |
|
|
| 13 Jan 2015 02:59 PM |
why are you cloning the mesh and not the hat lol?
R$6,526 |
|
|
| Report Abuse |
|
|
|
| 13 Jan 2015 02:59 PM |
LocalScript?
If yes, then LocalScripts can't acess ServerStorage, use ReplicatedStorage instead. |
|
|
| Report Abuse |
|
|
|
| 13 Jan 2015 03:02 PM |
| None of the scripts are local scripts, also the script im using only requires the mesh to be cloned. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 13 Jan 2015 03:06 PM |
bump, I want to know this too D:
~Do not be confident unless you know whats under the hood.~ |
|
|
| Report Abuse |
|
|
|
| 13 Jan 2015 03:07 PM |
@Power, no they don't...
~Do not be confident unless you know whats under the hood.~ |
|
|
| Report Abuse |
|
|
|
| 13 Jan 2015 03:08 PM |
@MrNoobe Actually most of them have to. |
|
|
| Report Abuse |
|
|
|
| 13 Jan 2015 03:09 PM |
Yes they do. You need to transfer it to a LocalScrip, and move the mesh to ReplicatedStorage; since LocalScripts can't acess ServerStorage. |
|
|
| Report Abuse |
|
|
|
| 13 Jan 2015 03:10 PM |
You said "GUI's need LocalScripts." meaning ALL GUIs...
~Do not be confident unless you know whats under the hood.~ |
|
|
| Report Abuse |
|
|
MisBloxy
|
  |
| Joined: 13 Sep 2008 |
| Total Posts: 164 |
|
|
| 13 Jan 2015 03:10 PM |
| first of all, server storage is for any type of object. its serverScriptServe that is only for scripts. put the hat in server storage, clone that hat using a localScript, and parent it to the player's character. |
|
|
| Report Abuse |
|
|
|
| 13 Jan 2015 03:14 PM |
You shouldn't need a local script if your using a gui just saying it's already what I would call 'semi-client sided'
Step 1: Put your hat in replicated storage
Step 2: Insert a script and put it inside the button
Step 3: Edit the script with the following code:
hat = game.ReplicatedStorage.hat -- edit 'hat' with the hat's name that's in repstorage player = script.Parent.Parent.Parent.Parent -- Ussing the button is found at starterGui > -- GUINAME > button
script.Parent.MouseButton1Click:connect(function() hat:Clone().Parent = game.Workspace:FindFirstChild(player.Name) end) |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 13 Jan 2015 03:15 PM |
| guys.... Gui's fo not need local scripts, they can work with server scripts you just have write it a bit different |
|
|
| Report Abuse |
|
|
|
| 13 Jan 2015 03:15 PM |
| p.Size = Vector3.new(0, 0, 0) -- If I'm correct a brick can't be 0,0,0 or it's considered 'nil' |
|
|
| Report Abuse |
|
|
|
| 13 Jan 2015 03:16 PM |
| @chimmihc, Mine is supposed to be a script, a normal one. |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 13 Jan 2015 03:19 PM |
| sorry dude I would debug your script but I'm on my phone |
|
|
| Report Abuse |
|
|
|
| 13 Jan 2015 03:20 PM |
| My script shouldn't need 'debugging'. |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 13 Jan 2015 03:21 PM |
| if it doesn't work then it does |
|
|
| Report Abuse |
|
|
|
| 13 Jan 2015 03:22 PM |
| Should work, don't see why it couldn't. |
|
|
| Report Abuse |
|
|
|
| 13 Jan 2015 03:22 PM |
| @Faded didn't work, I edited it so it would be precise but It still didnt work, I do have a hat remover script that works at the same time as this but it should still work right? Also I added print("Done") at the end and that didnt show in output so the script didn't work. |
|
|
| Report Abuse |
|
|
|
| 13 Jan 2015 03:24 PM |
Faded... It doesnt work...
~Do not be confident unless you know whats under the hood.~ |
|
|
| Report Abuse |
|
|
|
| 13 Jan 2015 03:24 PM |
Ok I took out the remvoer script and played the script faded suggested it worked but now I need the hat remover script to activate before the Hatgiver script how do i do that?
|
|
|
| Report Abuse |
|
|
|
| 13 Jan 2015 03:26 PM |
| wait() could be your best friend |
|
|
| Report Abuse |
|
|