So basically, I'm creating a handless tool where It spawns a "Handle" when you equip It, and gets attached to the player's arm. The problem is, since I'm using a localscript, the part is only seen by the tool wielder. Do you know how to solve It? I have been trying using ServerEvent, but for some reason, the part generated doesn't spawn, and doesnt even return an exception.
Heres the function to create the handle:
01 | function createHandle() |
02 | local part = Instance.new( "Part" ) |
03 | part.Parent = player |
04 | part.Name = "Handle" |
05 | part.Size = Vector 3. new( 0.2 , 0.2 , 4.08 ) |
06 | part.CanCollide = false |
07 | local mesh = Instance.new( "SpecialMesh" ,part) |
08 | mesh.Scale = Vector 3. new( 2 , 2 , 1.5 ) |
09 | mesh.MeshId = "http://www.roblox.com/asset/?id=54983181" |
10 | mesh.TextureId = "http://www.roblox.com/asset/?id=54983107" |
11 | return part |
12 | end |
The thing is, I tried using RemoteFunctions as well, but gave me the same results: nothing. No handle and not even an exception.
I have been testing with prints and I can confirm the remote function is invoked, even if it doesnt spawn the part.
Invoking the remote function in the localscript:
1 | local handle = batEvent:InvokeServer() |
Server script in the workspace:
01 | local rStorage = game:GetService( "ReplicatedStorage" ) |
02 | local batEvent = Instance.new( "RemoteFunction" , rStorage) |
03 | batEvent.Name = "batEvent" |
04 |
05 | function createHandle(player) |
06 | local part = Instance.new( "Part" ) |
07 | part.Parent = player |
08 | part.Name = "Handle" |
09 | part.Size = Vector 3. new( 0.2 , 0.2 , 4.08 ) |
10 | part.CanCollide = false |
11 | local mesh = Instance.new( "SpecialMesh" ,part) |
12 | mesh.Scale = Vector 3. new( 2 , 2 , 1.5 ) |
13 | mesh.MeshId = "http://www.roblox.com/asset/?id=54983181" |
14 | mesh.TextureId = "http://www.roblox.com/asset/?id=54983107" |
15 | return part |
16 | end |
17 |
18 | batEvent.OnServerInvoke = createHandle |