Basically I have this basketball script where when a player activates the tool, the tool's parent will go to workspace. From there if another player takes that tool (a block in basketball), then the server will fire. This is going through two functions, an activated and a touched function for the ball.

Local Script:

local toolplayer = game.Players.LocalPlayer
local tool = script.Parent
local handle = tool:FindFirstChild("Handle")

local Events = tool.Events
local BlockEvent = Events:WaitForChild("BlockEvent")

local d = true

tool.Activated:Connect(function()
	handle.Touched:Connect(function(hit) --is this okay in a local?
		local char = hit.Parent
		if tool.Parent == workspace and d then
			d = false
			wait(1)
			if tool.Parent == workspace then
				wait()	
			elseif tool.Parent == char then
				BlockEvent:FireServer(toolplayer, char) --doesnt fire.
			end
			wait(1)
			d = true
		end
	end)
end)

Server Script:

local tool = script.Parent
local Events = tool:WaitForChild("Events")
local BlockEvent = Events:WaitForChild("BlockEvent")

local stats = tool.Stats
local block = stats:WaitForChild("Block")

local SS = game:GetService("ServerStorage")
local Players = SS:WaitForChild("Players")

BlockEvent.OnServerEvent:Connect(function(Player, char)
	block.Value = true
	local player = game.Players:GetPlayerFromCharacter(char)
	local statplayer = Players:WaitForChild(player.Name)
	local serverstats = statplayer:WaitForChild("Stats")
	local block = serverstats:WaitForChild("Blocks")
	if Player.Name ~= player.Name then
		if Player.TeamColor ~= player.TeamColor then
			block.Value = block.Value + 1
			print('blocked')
		end
	end
	wait(1)
	block.Value = false
end)

I also have another script that actually might be preventing it. A Steal script.

ServerSide:

local tool = script.Parent
local handle = tool:WaitForChild("Handle")

local SS = game:GetService("ServerStorage")
local Players = SS:WaitForChild("Players")

local team = tool.team
local toolstats = tool.Stats
local assist = toolstats:WaitForChild("Assist")
local block = toolstats:WaitForChild("Block")

handle.Touched:connect(function(hit)
       if hit.Parent ~= nil then  -- if what you hit still exists
        local player = game.Players:GetPlayerFromCharacter(hit.Parent)
        if player and player.Character then
			--StealPlayer-- 
			local stealplayer = script.player
			local oldplayer = script.oldplayer
			stealplayer.Value = player.Name
			--Variables--
            local char = player.Character
            local torso = char:findFirstChild("Torso")
            local hum = char:findFirstChild("Humanoid")
			--\\Stats//--
			local statplayer = Players:WaitForChild(player.Name)
			local stats = statplayer:WaitForChild("Stats")
			local stealvalue = stats:WaitForChild("Steals")
            if torso and hum and hum.Health > 0 then
                local dist = (torso.Position - handle.Position).magnitude
                if dist < 6 then 
                    tool.Parent = char
				script.Disabled = true
				tool.Parent = workspace 
				wait() tool.Parent = hit.Parent
				if team.Value ~= player.TeamColor and block.Value == false then --makes the block script not useable, unless i add a value.
					stealvalue.Value = stealvalue.Value + 1
					print(stealvalue.Value)
				elseif team.Value == player.TeamColor and stealplayer.Value ~= oldplayer.Value and oldplayer.Value ~= "" then
					assist.Value = true
					print(assist.Value)
				end
			end
			wait(1.5)
		end
		script.Disabled=false
        end
    end   
end)

Thanks,

LukeGabrieI

3 comments

0

you literally have a wait(1) right before the remote is fired

0

line 15

0

because the ball goes into workspace.