Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Making a part spawn from a tool but the model doesn't show to other players?

    bin = script.Parent

  

function onButton1Down(mouse)

  

local model = bin.TVehicle:clone()

  

model.Parent = game.Workspace

model:MakeJoints()

model:MoveTo(mouse.hit.p)

wait(200000000000000000000000000000000000000000000000000000000000000000)

script.Parent:Remove()

  

end

  

function onSelected(mouse)

mouse.Icon = "rbxasset://textures\\GunCursor.png"

mouse.Button1Down:connect(function() onButton1Down(mouse) end)

end

  

  

  

bin.Selected:connect(onSelected)

Yeah, so this is a script that is suppose to spawn a part from when the tool is pressed it works but, it doesn't show to other players. Anyone help?

3 comments

0

filtering enabled

0

With Filtering Enabled, only YOU, the player using the Local Script, can see the difference, while others won't

0

remote event

1 answer

✓ Accepted answer

In this case, it would be a good solution to use remote events. To do this, you need to place a remote event in a client-visible location in your game.


Example places:

  • Workspace
  • Replicated First
  • Replicated Storage

Local Script:

bin = script.Parent
local RemoteEvent = [Remote Event Location]
  
function onButton1Down(mouse) 

    local model = bin.TVehicle  
    RemoteEvent:FireServer(mouse.hit.p, model)
    
	wait(200000000000000000000000000000000000000000000000000000000000000000)
    script.Parent:Remove()

end

function onSelected(mouse)
    
    mouse.Icon = "rbxasset://textures\\GunCursor.png"
    mouse.Button1Down:connect(function() onButton1Down(mouse) end)
    
end

bin.Selected:connect(onSelected)

Server Script:

local RemoteEvent = [Remote Event Location]

RemoveEvent.OnServerEvent:Connect(function (Player, Target, Model)

	local model = Model:Clone()
	model.Parent = game.Workspace
    model:MakeJoints() 
    model:MoveTo(Target)

end)

This discussion is preserved as it was. New answers, comments, and votes are closed.