✓ Accepted answer
When you write code in a LocalScript it only shows on your computer, not everyone else's.
If you want to show the part for everyone, you're going to have to create the part on the server. You can do this using remote events.
Here's how you'd to that:
Create a LocalScript in the StarterPlayerScripts
Create a remote event in the ReplicatedStorage, call it createPartEvent
Put the following code in the localscript:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local createPartEvent= ReplicatedStorage:WaitForChild("createPartEvent")
createPartEvent:FireServer()
Create a normal script in the ServerScriptService
Put the following code in the script:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local createPartEvent= ReplicatedStorage:WaitForChild("createPartEvent")
function createPart(player)
print(player.Name .. " fired the remote event")
a = Instance.new("Part")
a.Parent = workspace
a.Size = Vector3.new(50,10,50)
a.Anchored = true
a.Name = "corv"
a.CanCollide = false
a.Transparency = 0
a.Position = player.Character.LowerTorso.Position
end
createPartEvent.OnServerEvent:Connect(createPart)
Let me know if you have any questions.
This youtube video explains remote events/remote functions fairly well
this is a wiki article on it if you prefer to read. They actually go over how to do what you're trying to do in the Client to Server section of the article.
3 comments
Thanks
also should not 13th line in 4) be "local a = Instance.new("Part") ?
yes just wasnt paying attention when copying your code