So,
Recently a few people who have tried our game thought that it would be a good idea if the game was multiplayer. Im not too experienced with Roblox so I don’t know much about the difference between local scripts and regular scripts other than that local scripts run on the client side, and normal scripts run on the server side. I decided to start trying to make our game compatible with multiplayer on our first level. When you start out on the first level giant rabbits start falling out of the sky and you have to try not to get killed. Since we needed multiple scripts so multiple rabbits can fall out at the same time, we used a module script and required it from multiple different regular scripts. We basically just cloned a single rabbit in “ReplicatedService” and then made the rabbit clones positions at the position of a “dropperPart”. We also changed the position of the dropper part so that the rabbits don’t fall in a single place and its random. The problem is that when I require the module script from the local script, nothing happens. When I require it from a normal script, the expected result happens. Here are both of the scripts:
Module Script
--| REUSABLE SCRIPT TO DROP CLONED MODELS
local DropController = {}
function DropController.dropClone(model, dropperPart, randomPosition, randomSpeed)
local ReplicatedStorage = game.ReplicatedStorage
local Rabbit = ReplicatedStorage:WaitForChild(model)
local DropperPart = workspace.DropperParts:WaitForChild(dropperPart)
local rabbitPosition = DropperPart.Position
--| SET UPPER RANGE FOR RANDOM LOOP WAIT SPEED
local startSpeed = randomSpeed
--| Put it into another variable for reset
local newSpeed = startSpeed
--// Main Loop, waits to loop between 1 and the start speed
while wait(math.random(1,newSpeed)) do
local rabbitCopy = Rabbit:Clone()
rabbitCopy.Parent = workspace
-- Set new position
local newZ = math.random(rabbitPosition.z - randomPosition, rabbitPosition.z + randomPosition)
local newY = math.random(rabbitPosition.y - randomPosition + 100, rabbitPosition.y + randomPosition + 100)
local newX = math.random(rabbitPosition.x - randomPosition, rabbitPosition.x + randomPosition)
local newPosition = Vector3.new(newX,newY,newZ)
-- Set DropperPart to new position
DropperPart.Position = newPosition
-- Set Rabbit copy to new cropper part positon
rabbitCopy.Position = DropperPart.Position
--// 10 sec before clean up
game:GetService('Debris'):AddItem(rabbitCopy,math.random(2,5))
--| Decrement the upper range of the loop speed,
--| until it reaches 1, then reset it.
if newSpeed > 1 then
newSpeed = newSpeed - 1
else
newSpeed = startSpeed
end
end
end
return DropController
Local / Normal Script
local dropController = require(game.ServerStorage.DropController)
dropController.dropClone('rabbit', 'DropperPart', 60, 10)
Any help would be appreciated.
Thanks in Advance.