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

Help with Shark script (Sharks + Minnows)?

Basically, i'm making a sharks and minnows game and I need help with figuring out how to write the script. so far i have got this:

local Character = script.Parent.Parent.Character
local humanoid = Character:FindFirstChild("Torso")

function Infect(hit)
	if hit.Parent:FindFirstChild("Torso") then
		local player = hit.Parent.Name
		for i,v in pairs(game.Players:GetChildren()) do
			if v.Name == player then
					if v:FindFirstChild("BackPack") then
						local pack = v:FindFirstChild("BackPack")
						if pack:FindFirstChild("IsShark") then
							local IsShark = pack:FindFirstChild("IsShark")
								if IsShark == false then
									IsShark = true
								end
						end
					end
				else
			end
		end
	end
end

**EDIT:**I'm trying to make the script so that once a round starts, the main script will scan through all the players and if the value in their Backpack (IsShark) is set to true, then it will enable the script I have shown above, which should run a function so that when a 'shark' touches a person who isn't a 'shark' that person will have this script activated and there walkspeed changed

this is a script inside StarterPack and there are two boolValues in starterpack too, IsShark and IsPlaying. I have it so when the IsShark value is changed to true, it should change a players walkspeed and enable this script inside their backpack. However, i have trialed this and it won't work. I'm not too good with scripts like this one and any help would be useful. If you need more information, just ask.This is all in a Normal script

2 comments

0

What exactly do you want us to help you with? Could you please be more specific.

0

oh, sorry let me edit it

1 answer

I see, I copied your script and looked in the Developer Console and one of your variables are the one breaking this code.

"local character = script.Parent.Parent.Character"

I think I would use.

local player = game.Players.LocalPlayer
local character = player.Character

Comment on this and I'll be at the notification.

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