Hello, I would like to add mobile support to my game, but when I tried I got lots of glitches and errors. Any help?
Script:
There is a text button by the way if they press it I want the same thing to happen
game.ReplicatedStorage.Remotes.MousepOSITION.OnServerEvent:Connect(function(player, mousep)
if player.stats.Stamina.Value >= 15 then
local tweenservice = game:GetService('TweenService')
local clone = game.ReplicatedStorage.IceCube:Clone()
local char = player.Character
clone.CFrame = char.LowerTorso.CFrame
clone.Position = Vector3.new(clone.Position.X, 40, clone.Position.Z)
clone.Parent = char
local tweeninfo = TweenInfo.new(
1,
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
0,
false,
0
)
local tween = tweenservice:Create(clone, tweeninfo, {Position = mousep.Position})
tween:Play()
player.stats.Stamina.Value = player.stats.Stamina.Value - 15
tween.Completed:Wait()
local hitboxclone = game.ReplicatedStorage.HitBox:Clone()
hitboxclone.Parent = clone
hitboxclone.Position = clone.Position
local explosion = Instance.new('Explosion')
explosion.Parent = clone
explosion.BlastRadius = '10'
local smoke = game.ReplicatedStorage.Ice:Clone()
smoke.Parent = clone
clone:Destroy()
end
end)