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

Why aren't modulescript parented scripts not recreating objects parented to them?

Module script code is:

local module = {}

local function main(player)
	local player1 = game.Players[player]
	local character = player1.Character
	character.Humanoid.MaxHealth = math.huge
character.Humanoid.Health = math.huge	
	local hat = script.Model
	local hatweld = Instance.new("Weld",hat)
	hatweld.Part0 = character.Head
	hatweld.Part1 = hat.main
    hatweld.C1 = CFrame.new(0.95,0,0) *CFrame.Angles(0,0,math.rad(90))
	local locol = script.LocalScript
	locol.Parent = character
	locol.Disabled = false
	player1.Chatted:Connect(function(msg)
		if msg:sub(1,5) == "/play" then
        local victim = msg:sub(1,5)
			        local soundid = string.gsub(msg,victim,"")
			script.Sound.SoundId = "rbxassetid://"..soundid	
			script.Sound:Play()
		end
	end)
	script.rawdata.Changed:Connect(function()
		for i,v in pairs(hat.top.VisualiterPlate:GetDescendants()) do
			if v:IsA("Part") then
				v.Color = Color3.fromRGB(script.rawdata.Value/2.3,script.rawdata.Value/2.3,script.rawdata.Value/2.3)
			end
		end
	end)
	end
return main

localscript: meant for sending playbackloudness values to the server

print("script booted dude")
local player = game.Players.LocalPlayer
local mainscript = script.owner.Value
local remote = mainscript.RemoteEvent
print(mainscript)
local runserv = game:GetService("RunService")
runserv.Stepped:Connect(function()
	print("BUT IM SENDING IT")
	remote:FireServer(player,mainscript.Sound.PlaybackLoudness)
end)

script: needed to control the remote event such as setting the onserverevent

local remote = script.Parent.RemoteEvent
local hat = script.Parent.Model
remote.OnServerEvent:Connect(function(player,fakeplayer,clientmessage)
	script.Parent.rawdata.Value = clientmessage
	print(script.Parent.rawdata.Value)
	print(clientmessage)
end)

owner: object value, belongs to localscript but not getting recreated assets that work remoteevent rawdata: playbackloudness data Model: also a hat model welded to the players head with a weld Sound code used to run the modulescript

local mod = require(5376277920)
wait(5)
mod("antoniorigo4")

the error is

20:03:31.478 - owner is not a valid member of LocalScript
20:03:31.478 - Stack Begin
20:03:31.479 - Script 'Workspace.antoniorigo4.LocalScript', Line 3
20:03:31.480 - Stack End
--also this is when running it off a roblox id 
--but when using the "script i didnt upload to roblox, but its the same" in my game it works without any issues

yea im kinda sad that even my revamp didnt work so sorry for the being not so specific

2 comments

0

why are you looping fire event...........................

0

there is no darn error about exhausted duck virus million times the owner value isnt getting changed and its nil

1 answer

I did a waitforchild("owner") and it works but now i have this error

20:48:06.926 - Workspace.antoniorigo4.LocalScript:4: attempt to index nil with 'RemoteEvent'
20:48:06.927 - Stack Begin
20:48:06.928 - Script 'Workspace.antoniorigo4.LocalScript', Line 4
20:48:06.929 - Stack End

4 comments

0

remotevent doesnt exist

0

uhh the nil value is the modulescript and the remoteevent actually exists in the modulescript

0

wdym in the module script, it has to be in replicated storage

0

not really you can put it anywhere but not in the void tho

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