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

How can other players see my cloned blocks?

So I'm very VERY new so, I wanna start simple, by making a block building game, I tried to play with my friend but apparently, friend can't see my blocks, neither can I see theirs, code works fine but I think its the local script I used, I know that I needed a server script, but idk how... Help me pls!

-Local Script-

local Tool = script.Parent

Tool.Equipped:Connect(function(Mouse) Mouse.Button1Down:Connect(function()

	local clone = game.ReplicatedStorage.Part:Clone()
	clone.Parent = workspace
	clone.Position = script.Parent.INVI.Position
	clone.Orientation = script.Parent.INVI.Orientation

end)

end)

local Nothing = 0

repeat game.ReplicatedStorage.Part.BrickColor = BrickColor.new("Really red") wait (.1) game.ReplicatedStorage.Part.BrickColor = BrickColor.new("Deep orange") wait (.1) game.ReplicatedStorage.Part.BrickColor = BrickColor.new("New Yeller") wait (.1) game.ReplicatedStorage.Part.BrickColor = BrickColor.new("Lime green") wait (.1) game.ReplicatedStorage.Part.BrickColor = BrickColor.new("Really blue") wait (.1) game.ReplicatedStorage.Part.BrickColor = BrickColor.new("Royal purple") wait (.1) until Nothing == 1

1 comment

0

Please fixit, and put it in code line

1 answer

You Need to create a RemoteEvent See here for more info:

This is a local Script


-- This is a local script
local ReplicatedStorage = game:GetService("ReplicatedStorage") 
local RemoteEvent = ReplicatedStorage.RemoteEvent

local Tool = script.Parent

Tool.Equipped:Connect(function(Mouse)
Mouse.MouseButton1Down:Connect(function() 
RemoteEvent:FireServer() 

end) 

This is a Server Script


-- This is a Server Script

local ReplicatedStorage = game:GetService("ReplicatedStorage") 
local RemoteEvent = ReplicatedStorage.RemoteEvent


RemoteEvent:OnServerEvent:Connect(function() 
local clone = game.ReplicatedStorage.Part:Clone()
    clone.Parent = workspace
    clone.Position = script.Parent.INVI.Position
    clone.Orientation = script.Parent.INVI.Orientation

end)

Also a Server Script


-- Server Script, for the brick color changer
local Nothing = 0

repeat game.ReplicatedStorage.Part.BrickColor = BrickColor.new("Really red") wait (.1) game.ReplicatedStorage.Part.BrickColor = BrickColor.new("Deep orange") wait (.1) game.ReplicatedStorage.Part.BrickColor = BrickColor.new("New Yeller") wait (.1) game.ReplicatedStorage.Part.BrickColor = BrickColor.new("Lime green") wait (.1) game.ReplicatedStorage.Part.BrickColor = BrickColor.new("Really blue") wait (.1) game.ReplicatedStorage.Part.BrickColor = BrickColor.new("Royal purple") wait (.1) until Nothing == 1

Note: The script I've written may not be correct and misspelled since I am on my phone.

1 comment

0

its says its an error in the first server script RemoteEvent:OnServerEvent:Connect(function() the colon is an error here

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