Toggle system for Blood, Gibs and Stuff

I’m trying to make a toggle system when you click a button, it enables Blood/gibs and stuff

I cannot move the models into the folder. I get the error "GoreModels are not a part of replicatedstorage.Assets

Ive seen other experiences do this, I just cant figure out how…

local button = script.Parent
local replicatedStorage = game:GetService("ReplicatedStorage")

button.MouseButton1Click:Connect(function()

	local player = game.Players.LocalPlayer
	if not player then
		return
	end

	local folderToMove = game.ReplicatedStorage.GoreModels

	local assetsFolder = replicatedStorage.Assets
	folderToMove.Parent = assetsFolder
	
end)

Any solutions?

2 Likes

Simply put

	local folderToMove = game.ReplicatedStorage:WaitForChild("GoreModels")

try it and let me know, therefore you said “GoreModels are not a part of replicatedstorage.Assets” is kinda confusing since the GoreModels intially based on your script is outside of assetsfolder, and you just moved it in

1 Like

So just in case that whatever you trying to find, just note that the “GoreModel” initially is not in the AssetFolder, it is moved after the script is ran

Otherwise, just use local yourvariable = RPStorage.Assets:WaitForChild(GoreModels)

1 Like

The error message “GoreModels are not a part of replicatedstorage.Assets” suggests that the GoreModels folder is not located within the Assets folder in ReplicatedStorage . To resolve this issue, you need to make sure that the GoreModels folder is in the correct location before attempting to move it.

local button = script.Parent
local replicatedStorage = game:GetService("ReplicatedStorage")

button.MouseButton1Click:Connect(function()
    local player = game.Players.LocalPlayer
    if not player then
        return
    end

    -- Check if GoreModels folder exists in ReplicatedStorage
    local folderToMove = game.ReplicatedStorage:FindFirstChild("GoreModels")
    if not folderToMove then
        return
    end

    -- Move the GoreModels folder to Assets folder
    local assetsFolder = replicatedStorage.Assets
    folderToMove.Parent = assetsFolder
end)

I am still getting the error “Gore Models is not a valid member of ReplicatedStorage.Assets” Even though it is inside of ReplicatedStorage.Assets after the button is pressed.

Are you sure that haves the EXACT name?

Yes, i just checked the code again

Wait, in there saying “Gore Models” not GoreModels

I just mistyped it, it says GoreModels. I dont think anything is wrong with my code:

	for index, gibModel in pairs(replicatedStorage.Assets.GoreModels.Burst:GetChildren()) do
		if gibModel:IsA("Model") then

This is a part of the gore code, is there a way I can check if its there or something. Its there in replicated storage and everything else. Its just that its not detecting it or some other reason.

If you’re confident that the GoreModels folder exists in replicatedStorage.Assets and the issue lies with detecting it in your code, you can add some debug output to help diagnose the problem.

local button = script.Parent
local replicatedStorage = game:GetService("ReplicatedStorage")

button.MouseButton1Click:Connect(function()
    local player = game.Players.LocalPlayer
    if not player then
        return
    end

    local assetsFolder = replicatedStorage.Assets

    -- Check if GoreModels folder exists in Assets folder
    local goreModelsFolder = assetsFolder:FindFirstChild("GoreModels")
    if not goreModelsFolder then
        print("GoreModels folder not found in Assets folder.")
        return
    end

    print("GoreModels folder found in Assets folder.")

    -- Perform further operations with the goreModelsFolder if needed
    -- ...

end)

This is some of the code, i dont really know what to do. Or how to check and make sure. I added your code to the button and it still did not work…

function module.getGibFromOffset(limb, stage, offset)
	local gibVar = "Middle"
	local maxDist = 5
	for index, gibModel in pairs(replicatedStorage.Assets.GoreModels.Burst:GetChildren()) do
		if gibModel:IsA("Model") then
			local name = noSpaceLimbTable[limb].."Burst"
			if string.sub(gibModel.Name, 1, string.len(name)) == name and string.sub(gibModel.Name, string.len(gibModel.Name), string.len(gibModel.Name)) == tostring(stage) then
				local properties = gibModel:FindFirstChild("data")
				properties = properties and require(properties) or {}
				local gibOffset = properties.offset or Vector3.new()
				local dist = (gibOffset - offset.Position).magnitude
				if dist < maxDist then
					gibVar = string.sub(gibModel.Name, string.len(name)+1, string.len(gibModel.Name)-1)
					maxDist = dist
				end
			end
		end
	end

So does the script work or no …?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.