I looked for articles about this and I can’t find a solution.
So its pretty straightforward, I’m making a trigger box with a script to show gui and to hide it depending if you’re in the trigger box or not.
I get no errors but it seems to never call the onTouched function
I actually changed the function connecting from the easier way of doing it
script.Parent.Touched:Connect(function()
to the onTouched function way because I thought that might’ve done something, but it didn’t , so thats why the way of coding the ontouched function is weird in this script.
local fuseGui = game.Players.LocalPlayer.PlayerGui:WaitForChild("Misc"):WaitForChild("Fuser")
local function resetFuseGui()
fuseGui.Title.Text = "'element' Magic Plushie Fuser"
fuseGui.PlushList.Text = "plush,plush,plush,plush"
fuseGui.Fuse.Image = "http://www.roblox.com/asset/?id=8483123699"
fuseGui.Visible = false
end
function onTouched(part)
print("success")
resetFuseGui()
fuseGui.Title.Text = "Neutral Magic Plushie Fuser"
fuseGui.PlushList.Text = "White Winged, White Basic, Yellow WInged, Yellow Basic, Blue Winged, Blue Basic, Green Winged, Green Basic, Red Winged, Red Basic"
fuseGui.Fuse.Image = "http://www.roblox.com/asset/?id=8483123699"
fuseGui.Visible = true
end
function onTouchedEnded(part)
resetFuseGui()
end
script.Parent.Touched:connect(onTouched)
script.Parent.TouchedEnded:connect(onTouchedEnded)
this is a local script btw
the text and stuff is weird lol but don’t pay attention to that
Also, I’m new to scripting lol, I’ve used remote events once so could you help me on how I could turn this code into server script compatible? Sorry for the inconvenience lol
where is the localscript? is it in a part in the workspace? because if it is then localscripts cant run in the workspace
For remote events read this RemoteEvent (roblox.com)
Edit: sorry I meant read this Remote Functions and Events (roblox.com)
If you still don’t understand something you can ask me
with workspace.PATH TO PART.touched:Connect
also you should capitalize Connect im pretty sure connect got deprecated
but learning remote events would help you a lot in the future so I think you should try doing it with remote events
Is the script inside a Gui Button? If so, then replace .Touched into .MouseButton1Down and replace .TouchEnded into .MouseButton1Up
local fuseGui = game.Players.LocalPlayer.PlayerGui:WaitForChild("Misc"):WaitForChild("Fuser")
local function resetFuseGui()
fuseGui.Title.Text = "'element' Magic Plushie Fuser"
fuseGui.PlushList.Text = "plush,plush,plush,plush"
fuseGui.Fuse.Image = "http://www.roblox.com/asset/?id=8483123699"
fuseGui.Visible = false
end
function onTouched(part)
print("success")
resetFuseGui()
fuseGui.Title.Text = "Neutral Magic Plushie Fuser"
fuseGui.PlushList.Text = "White Winged, White Basic, Yellow WInged, Yellow Basic, Blue Winged, Blue Basic, Green Winged, Green Basic, Red Winged, Red Basic"
fuseGui.Fuse.Image = "http://www.roblox.com/asset/?id=8483123699"
fuseGui.Visible = true
end
function onTouchedEnded(part)
resetFuseGui()
end
script.Parent.MouseButton1Down:Connect(onTouched)
script.Parent.MouseButton1Up:Connect(onTouchedEnded)