Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago
    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?

0
filtering enabled hellmatic 1523 — 5y
0
With Filtering Enabled, only YOU, the player using the Local Script, can see the difference, while others won't User#23357 0 — 5y
0
remote event MArzalAlBuchariZ 33 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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)
Ad

Answer this question