I’ve made a message system, where theres a trigger box that makes UI visible on touch. I’ve been trying to implement an interactive system(basically a proximity prompt but with the message system instead) in the same script. I’ve got that working, however I need the interaction to actually do something. In this case its supposed to move a part in the workspace on the client side. I honestly just don’t know how to do this lol(I’m pretty new to LuaU still), could I get some help? I was thinking of using remote events but since I want the part to only be moved on the local player side I don’t think that’ll work.
the mouse click function’s where I need help
this is a local script in StarterGui btw
--Preset and color settings--
local Player = game:GetService("Players").LocalPlayer
repeat wait() until Player.Character
local Character = Player.Character
local RootPart = Character:WaitForChild("HumanoidRootPart")
local CurrentTrigger
local AlertScreen = Player:WaitForChild("PlayerGui").Alerts
local Alert = AlertScreen:WaitForChild("Interact")
local AlertStartPos = UDim2.new(0.367, 0,0, 0)
local AlertEndPos = UDim2.new(0.367, 0,0.05, 0)
local BoxActive = true
--Preset and color settings--
local Presets = {
Color3.new(0, 0.45098, 1); -- Blue
Color3.new(1, 0, 0.0156863); -- Red
}
function AlertConfig(box)
--Variables
local config = box.Configuration
local PresetBool = config.AlertPreset.Value
local CustomColor = config.CustomColor.Value
local PresetID = config.AlertPreset.AlertPresetID.Value
local AlrtTransparency = config.AlertTransparency
local AlertColor
if PresetBool == true then
AlertColor = Presets[PresetID]
else
AlertColor = CustomColor
end
Alert.BackgroundTransparency = AlrtTransparency
Alert.BackgroundColor3 = AlertColor
return AlertColor
end
RootPart.Touched:Connect(function(hit)
if hit.Name == "InteractBox" and BoxActive == true then
AlertConfig(hit)
CurrentTrigger = hit.ID.Value
Alert.Position = AlertStartPos
Alert.Text = hit.DisplayText.Value
Alert.Visible = true
Alert:TweenPosition(AlertEndPos,0,0,0.07,true)
Alert.MouseButton1Click:Connect(function()
--idk what to do here--
end)
end
end)
RootPart.TouchEnded:Connect(function(hit)
if hit.Name == "InteractBox" then
CurrentTrigger = nil
Alert:TweenPosition(AlertStartPos,0,0,0.07,true)
wait(0.1)
Alert.Visible = false
Alert.Text = "Text"
end
end)