My friend touched the script and now it isnt working

If you know me business, I got enslaved/hired to make a transfur game.
I made a script for her that was working. She touched the script and now it is not triggering at all.

local part = script.Parent
local player = game.Players.LocalPlayer
local function onTouch(touchpart)
	script.Parent["Becoming Furry"]:Play()
	if touchpart.Parent == player.Character then
		print(player.Name.." is becoming "..part.Name)
		player.PlayerGui.FurryMeter.FurryValue.Value += 5
	end
end

part.Touched:Connect(onTouch)

local part = script.Parent
local player = game.Players.LocalPlayer
local function onTouch(touchpart)
	if touchpart.Parent == player.Character then
		if game.Players.LocalPlayer.PlayerGui.FurryMeter.FurryValue.Value >= 95 and game.Players.LocalPlayer.PlayerGui.FurryMeter.IsASpecies.Value == "" then
			game.Players.LocalPlayer.PlayerGui.FurryMeter.IsASpecies.Value = script.Parent.Name
		end
	end
end

part.Touched:Connect(onTouch)

2 Likes

Could it be one of the if statements not allowing the touch code to function? Put print functions at key areas and see which stuff passes through. You can also put comparisons within print statements like this: print(5 < 3) —This will print false

2 Likes

It didn’t even play a sound. It could be caused by her changes with goos. After that, she parented the scripts and sound to model. Tried parenting them back to part, but still nothing.

1 Like

Open a new place, make a part, and then put your script it. Play it, and see if it triggers. If it does, your script is ok, but something else in the game is causing the problem.

2 Likes

I made a testing place before (on her command) and it works fine there.

The testing place:

1 Like

The issue is probably with the part you are wanting to touch. Make sure its not set to ‘can touch = false’ or something like that.

1 Like

From the picture they looked like local scripts, are they actually parented somewhere a local script can run?

1 Like

Shown a screenshot showing the part’s CanTouch

1 Like

I think that those are scripts set on Client but I’ll check again.

1 Like

Oh yeah, sorry I missed that.
Your test place works fine, so not sure what it could be.

1 Like

Local scripts can run under parts now, as long as the RunContext is ‘Client’

1 Like

Could it be the shape of the object you are standing on?
Maybe your feet aren’t quite touching them?
Or if you are inside of a larger invisible part, that might interfere with touching.
Not sure but I think there used to be an issue, that if a part was inside of another part, it wouldn’t detect touch events.

1 Like
Top Down Programming
task.wait(3)
local part = script.Parent
local player = game:GetService("Players").LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
local char = player.Character or player.CharacterAdded:Wait()
local furry = playerGui:WaitForChild("FurryMeter"):WaitForChild("FurryValue")
local sound = part:WaitForChild("becomingFurry")
local db = true

function onTouch(touch)
	if touch.Parent == char then
		if db then db = false sound:Play()

			print(player.Name.." is becoming "..part.Name)
			furry.Value += 5

			task.wait(0.5)
			db = true
		end
	end
end

part.Touched:Connect(onTouch)
task.wait(3)
local part = script.Parent
local player = game:GetService("Players").LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
local char = player.Character or player.CharacterAdded:Wait()
local meter = playerGui:WaitForChild("FurryMeter")
local furry = meter:WaitForChild("FurryValue")
local species = meter:WaitForChild("IsASpecies")
local db = true

function onTouch(touch)
	if touch.Parent == char then
		if db then db = false
			if furry.Value >= 95 and species.Value == "" then
				species.Value = script.Parent.Name
			end	task.wait(0.33)
			db = true
		end
	end
end

part.Touched:Connect(onTouch)

Easier to work with and debug.
Added pauses and avoiding spaces.

I am so dumb.

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